Facebook App: depolama ile ilgili sorun kullanıcı bilgisi

1 Cevap php

I want to store basic user info like name and proxied email into my MySQL database. Here's my code

$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login($required_permissions = 'publish_stream','status_update','email');

$con = mysql_connect("xxxx","xxxxx","xxxxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("xxx_userdb", $con);
//Uptil Here it is working fine...No problem with db connection

$fql_firstname = "select first_name from user where uid = '$user'";
$fql_lastname = "select last_name from user where uid = '$user'";
$fql_email = "select proxied_email from user where uid = '$user'";


$fql_fname_result = $facebook->api_client->fql_query($fql_firstname);
$fql_lname_result = $facebook->api_client->fql_query($fql_lastname);
$fql_email_result = $facebook->api_client->fql_query($fql_email);

echo "<pre>FQL Result:" . print_r($fql_fname_result,true) . "</pre>";
echo "<pre>FQL Result:" . print_r($fql_lname_result,true) . "</pre>";
echo "<pre>FQL Result:" . print_r($fql_email_result,true) . "</pre>";

İşte olsun çıkış var

FQL Result:

FQL Result:

FQL Result:

Ben yanlış ne yapıyorum?

1 Cevap

Benim soruşturma, burada think Senin sorunun ne olabileceğini olduğunu.

Facebook API yılında uid olup int ve FQL int bir uid belirterek olmalıdır (ancak bir dize olarak uygulanır) yani not bir dize.

Değişim

$fql_firstname = "select first_name from user where uid = '$user'";
$fql_lastname = "select last_name from user where uid = '$user'";
$fql_email = "select proxied_email from user where uid = '$user'";

Karşı

$fql_firstname = "select first_name from user where uid = $user";
$fql_lastname = "select last_name from user where uid = $user";
$fql_email = "select proxied_email from user where uid = $user";

I $user uid döndürür umuyoruz.


Observation update

Ayrıca, (sadece durumda) neden (PHP doğru ise gerçekten emin değil) çalışmayın böylece, fql_query veri dizisini döndürür çağırıyor

echo "<pre>FQL Result:" . print_r($fql_fname_result[0],true) . "</pre>";
echo "<pre>FQL Result:" . print_r($fql_lname_result[0],true) . "</pre>";
echo "<pre>FQL Result:" . print_r($fql_email_result[0],true) . "</pre>";