开发者

Php syntax error t_variable error?

Im trying to post to the users wall i have there id and offline token stored in the database

$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>";

for some resson it is not posting ???


$target = $row['uid'] needs a semicolon after it.


  1. Make sure you are including and initializing the Facebook library properly: $facebook = new Facebook(...);
  2. Make sure your app has granted the publish_stream permission
  3. wrap your Facebook calls in a try/catch clause to catch errors - reference
  4. You don't need the offline_access permission
  5. Based on #4, you don't need to append the access_token in your $attachment var
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜