title: using an associative array to update a table using mysqli
body: <p>I am trying to perform an update statement using mysqli with values from a associative array. 
  I can call the values I want using <code>$array2[0]["id"]</code>etc. 
  So I need the statement to execute for each value in the array. </p>
  
  <p>This was my last attempt at this I cant see why it is not working (my mysqli skills are very basic) :</p>
  
  <pre><code>$query = "update  stockistsWorld
                  set     lat =  '?' and lng =  '?'   
                  where   'id' =  '?' ";
  
          if($stmt = $this-&gt;conn-&gt;prepare($query)){ //if connect
              foreach($array as $one){
                  $stmt = $mysqli-&gt;prepare($query);
                  $stmt -&gt;bind_param("ssi", $one["lat"],$one["lng"],$one["id"]);
                  $stmt-&gt;execute();
              }       
              $stmt-&gt;close(); 
          }
  </code></pre>
  
  <p>array is passed to this statement from the method call <code>addLatLng($array)</code> 
  If i am doing this completely wrong i appologise, but in my head it looks like it should work</p>