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.
- Make sure you are including and initializing the Facebook library properly:
$facebook = new Facebook(...);
- Make sure your app has granted the
publish_stream
permission - wrap your Facebook calls in a
try/catch
clause to catch errors - reference - You don't need the
offline_access
permission - Based on #4, you don't need to append the
access_token
in your$attachment
var
精彩评论