2012-01-19 94 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

美麗!謝謝。 –