2012-01-19 61 views
1

这里有一些语法问题。试图让喜欢使用像这样一个变量的任何页面上计数:在fql查询中使用变量

$url = "http://www.my-domain.com" 
$result = $facebook->api(array(
    'method' => 'fql.query', 
    'query' => 'SELECT total_count from link_stat where url ="$url"; 
)); 
$fb_fans = $result[0]['total_count']; 

但是它的工作原理,当我与实际值替换$网址为这样:

$result = $facebook->api(array(
    'method' => 'fql.query', 
    'query' => 'SELECT total_count from link_stat where 
    url ="http://www.my-domain.com"; 
)); 
$fb_fans = $result[0]['total_count']; 

谁能告诉我我是什么显然在这里看?

回答

0
 

$url = "http://www.my-domain.com" 
$result = $facebook->api(array(
    "method" => "fql.query", 
    "query" => "SELECT total_count from link_stat where url ='".$url."'" 
)); 
$fb_fans = $result[0]['total_count']; 
 
+0

美丽!谢谢。 –