Skip to content
Advertisement

php variable ask ques

My goal is to grab the name of a page by querying the page ID. And then store it in a variable.

The current code I have for doing part of this is below, however as you can see the only thing I’ve done with the data is print it.

CODE:

$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
'cookie' => true,
));

$fql = "SELECT name from page WHERE page_id='$textfield'";

$response = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));

print_r($response);

OUTPUT:

Array ( [0] => Array ( [name] => pagename ) )

I want just the plaintext of the pagename stored in a variable, not this Array ( [0] => Array ( [name] =>...))

Advertisement

Answer

Here how you retrieve it:

echo $response[0]['name'];
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement