2011-09-28 42 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
相关问题