In short, guys. There is code:
for($i = 0; $i < count($groups); $i++){
/* $find = mysql_query("SELECT * FROM groups_data WHERE group_id=".$groups[$i]);
$find = mysql_fetch_assoc($find);
if(empty($find['group_id'])){
mysql_query("INSERT INTO groups_data (group_id,post_id) VALUES (".$groups[$i].",0)") or die(mysql_error()); //add our group to the database, post_id setting default 0
} else {*/
$wallGet = api("https://api.vk.com/method/wall.get?owner_id=-".$groups[$i]."&count=1");
$wallGet = json_decode($wallGet);
$id = $wallGet->response[1]->id.' ';
$group = $groups[$i];
$res = mysql_query("UPDATE groups_data SET `post_id`='".$id[$i]."' WHERE `group_id`='".$groups[$i]."';");
echo $res.'<br>';
# }
}
He somehow writes data only to the first group_id, and then - no, what to do?
in $groups is:
$groups = array('122860616','122860645','122860660');
$res_sql = "UPDATE groups_data SET `post_id`='".$id[$i]."' WHERE `group_id`='".$groups[$i]."';";
$res = mysql_query($res_sql);
echo $res.'
'; - dalton_Mora commented on July 8th 19 at 16:12