I am trying to update my database table inside a foreach loop but it doesn't seem to work
I dont know where is the problem or what am doing wrong.
foreach($ids as $id_number=>$id)
{
$request = "http://api.twitter.com/1/users/lookup.json?user_id=".$id."";
$response = file_get_contents($request);
$ok = json_decode($response,true);/*print_r($ok);*/
foreach($ok as $p)
{
$location=$p['location'];
$query=mysql_query("UPDATE tweets SET location=$location
WHERE from_user_id=$id");
}
if($query)
echo'ok';
else
echo'no';
}
It will be helpful if someone knows another way of doing this!