Php语法错误t_变量错误?
我试图张贴到用户墙我有那里的id和离线令牌存储在数据库中Php语法错误t_变量错误?,php,facebook,Php,Facebook,我试图张贴到用户墙我有那里的id和离线令牌存储在数据库中 $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_err
$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,它没有发布???$target=$row['uid']后面需要一个分号
确保您正确地包括并初始化了Facebook库:$Facebook=newfacebook。。。;
确保您的应用程序已授予发布流权限
在try/catch子句中包装您的Facebook呼叫以捕获错误-
您不需要脱机访问权限
基于4,您不需要在$attachment变量中追加access_令牌
同样的错误?我们可以在错误所说的那一行之前再看一些脚本吗?您使用的是Eclipse还是其他IDE?它将有语法高亮显示,并让您在出现解析错误时看到。另外,这是这段代码唯一的一点错误,所以你的问题在别处。脚本没有发布到任何一个墙,所有的令牌和ID都存储在那里,probley已经测试过了。。。您能看到脚本无法发布到用户页面的任何问题或方式吗?$ret_代码的值是多少?我认为访问令牌应该附加到URL,而不是在$attachment中发布。。。