I am using while loop to post on users wall through application. While loop executes only once and post on users wall once at a time. I wonder why this is happening.
while($data = mysql_fetch_array($result)){
echo "posting in userwall";
$facebook->api('/'.$data['postid'].'/feed?access_token='.$data['token_key'], 'post', $attachment);
}
The above code executes only one time even if there are many rows. However when i comment second line “$facebook->api(‘/’.$data[‘postid’].’/feed?access_token=’.$data[‘token_key’], ‘post’, $attachment);” it runs as many times it has rows. for eg
while($data = mysql_fetch_array($result)){
echo "posting in userwall";
//$facebook->api('/'.$data['postid'].'/feed?access_token='.$data['token_key'], 'post', $attachment);
}
I have two rows data and it shows o/p two times. However while i use “$facebook->api(‘/’.$data[‘postid’].’/feed?access_token=’.$data[‘token_key’], ‘post’, $attachment);” it runs only once why?
Try:
$facebook->api('/'.$data['postid'].'/feed', 'post', $attachment);