if ($session)
{
//fb query
try
{
$me = $facebook->api('/me');
}
catch (FacebookApiException $e)
{
echo $e->getMessasge();
}
}
if($me){
$logoutUrl = $facebook->getLogoutUrl();
echo "<a href='$logoutUrl'>Logout</a>";
}
else{
$loginUrl = $facebook->getLoginUrl($params);
echo "<a href='$loginUrl'>Login</a>";
}
echo $me['first_name'];
$me['first_name'] = $test;
echo $test;
I am trying to set Facebook Graph API variables to other variables (particularly session variables). I tried Session variables but it didn’t work so I took a step back. In this example, it prints out $me['first_name'] but not $test. Am I missing something simple here? I can’t seem to transfer the value over. Eventually I’d like to take the value and enter it into a MySQL row but I can’t get it to work on a simple variable.
I’ve got all the setup correct before this bit of code because it does display the variable correctly on the $me['first_name'] but not on $test.
Thanks for the help and I apologize if it’s a super basic problem that I’m just overlooking.
Where do you set $test?
Or do you mean
$test = $me['first_name'];(i.e. you have the assignment the wrong way round?)