title: update mysql using php does not work
body: <p>I am trying to update my database table inside a foreach loop but it doesn't seem to work</p>
  
  <p>I dont know where is the problem or what am doing wrong.</p>
  
  <pre><code>foreach($ids as $id_number=&gt;$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';
  }       
  </code></pre>
  
  <p>It will be helpful if someone knows another way of doing this!</p>