Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无格式FB注册_Php_Mysql_Pdo - Fatal编程技术网

Php 无格式FB注册

Php 无格式FB注册,php,mysql,pdo,Php,Mysql,Pdo,所以我让FB connect使用PHPSDK工作。首先,当用户注册时,它会自动创建他们的个人资料(个人资料img、全名、年龄、性别、工作/雇主、电子邮件等) 所以它工作得很好,只需单击一下,就可以创建概要文件 然而,我试图做到这一点,当用户单击“使用Facebook注册”按钮时,它会将用户数据额外存储在后台和后端。我是否必须通过提交表单按钮进行操作,并将下面的所有变量定义为$\u POST来存储它?(我正在使用PDO/MySQL来实现这一点,请参见下面的示例) 我尝试了以下方法,但不起作用 $u

所以我让FB connect使用PHPSDK工作。首先,当用户注册时,它会自动创建他们的个人资料(个人资料img、全名、年龄、性别、工作/雇主、电子邮件等)

所以它工作得很好,只需单击一下,就可以创建概要文件

然而,我试图做到这一点,当用户单击“使用Facebook注册”按钮时,它会将用户数据额外存储在后台和后端。我是否必须通过提交表单按钮进行操作,并将下面的所有变量定义为$\u POST来存储它?(我正在使用PDO/MySQL来实现这一点,请参见下面的示例

我尝试了以下方法,但不起作用

$user = "xxxx";
$pwd = "xxxx";

$odb = new PDO("mysql:host=localhost;dbname=xxxx;", $user, $pwd);

$q = "INSERT INTO users(u_fullname, age, u_location, u_gender, u_bday, u_employer, u_job) VALUES(:u_fullname, :age, :u_location, :u_firstname, :u_gender, :u_bday, :u_employer, :u_job)";
$query = $odb->prepare($q);
$results = $query->execute(array(":u_fullname" => $u_fullname, ":age" => $age, ":u_location" => $u_location, ":u_gender" => $u_gender, ":u_bday" => $u_bday, ":u_employer" => $u_employer, ":u_job" => $u_job));
这是配置文件设置

<? $fbuid = $user_profile['id'];
$u_employer = $user_profile['work'][0]['employer']['name'];
$u_job = $user_profile['work'][0]['position']['name'];
$u_firstname = $user_profile['first_name'];
$u_fullname = $user_profile['name'];
$u_location = $user_profile['location']['name'];
$u_gender = ucfirst($user_profile['gender']);
$u_bday = $user_profile['birthday'];
//explode the date to get month, day and year
$u_bday = explode("/", $u_bday);
//get age from date or birthdate
$age = (date("md", date("U", mktime(0, 0, 0, $u_bday[0], $u_bday[1], $u_bday[2]))) > date("md") ? ((date("Y")-$u_bday[2])-1):(date("Y")-$u_bday[2]));?>


任何帮助都将不胜感激

您需要什么样的帮助?无论出于何种原因,配置文件数据没有存储到数据库中。我很好奇,在这个问题上比我更了解的人是否能指出我做错了什么。那么它是从facebook上检索的吗?是的,检索/回显没有问题。那么这个问题与facebook有什么关系(占整个问题的95%),那么如果你不能做的是处理数据库?