2011-09-28 40 views
-2

我試着張貼到牆上的用戶我已經有ID和離線令牌存儲在數據庫中Php語法錯誤t_variable錯誤?

$result22 = mysql_query("SELECT token FROM usersoffline", $link2); 
$num_rows2 = mysql_num_rows($result22); 
// Get all the data from the "example" table 
$result = mysql_query("SELECT * FROM usersoffline") 
or die(mysql_error()); 
echo "<table border='1'>"; 
echo "<tr> <th>id</th> <th>Toekn</th> </tr>"; 
// keeps getting the next row until there are no more to get 
while($row = mysql_fetch_array($result)) { 
    // Print out the contents of each row into a table 
    echo "<tr><td>"; 
    echo $row['uid']; 
    echo "</td><td>"; 
    echo $row['token']; 
    echo "</td></tr>"; 


$target = $row['uid'] ; 
    $attachment = array(
      'access_token' => $row['token'], 
       'message' => 'Did a Test Post :', 
        'name' => "Offline posting using stored tokens", 
        'link' => "url", 
        'description' => "This post was made using a stored access token", 
       'picture'=>"", 
      ); 
    $ret_code=$facebook->api('/'.$target.'/feed', 'POST', $attachment); 



} 
echo "</table>"; 

一些resson它沒有發佈???

+0

$ ret_code的值是多少?我相信訪問令牌應附加到URL,不張貼在$附件中... –

回答

3

$target = $row['uid']後面需要分號。

+0

仍然是一個問題....它死了腳本..... – user967149

+0

同樣的錯誤?我們可以在錯誤正在討論的那一行之前看到更多的腳本嗎? –

+0

我添加了完整的腳本 – user967149

0
  1. 請確保您包括並正確初始化Facebook的庫:$facebook = new Facebook(...);
  2. 確保您的應用已授予publish_stream許可
  3. 包裝您的Facebook在try/catch子句抓呼籲錯誤 - reference
  4. 您不需要offline_access權限
  5. 根據#4,您不需要附加access_token在你的$attachment var
相關問題