title: php update mysql statement not working but same query works via phpmyadmin sql menu
body: <p>I am running a script to update a MySQL table, and I have been echoing the update statement to help troubleshoot why the update statement was not working.  When I copy and paste the echoed query for the mysql update into the SQL menu in phpmyadmin, it works perfectly, but when I run the script the update query does not execute.  I know I have successfully connected to the database.  Does anyone know why an echoed version of the update statement copy and pasted into the sql tab of phpmyadmin would execute successfully, but not the actual query that is supposed to be executed the line before the echoed statement?  Here is my php: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type"&gt;
  &lt;title&gt;Untitled 1&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  $user = 'tunemashercom';
  $pass = 'password';
  $host = 'tunemashercom.ipagemysql.com';
  $db_name = 'user_library';
  @ $db = mysqli_connect($host, $user, $pass, $db_name);  
  
  if (mysqli_connect_errno()) {
      echo 'Error: Could not connect to database.';
      exit;
  }
  
  $oldsongs = $_POST['oldsongs'];
  $newsongs = $_POST['newsongs'];
  $count = count($newsongs);
  $count2 = count($oldsongs);
  echo "COUNT 1: ".$count." - COUNT 2: ".$count2."&lt;br /&gt;";
  for($i=0;$i&lt;=$count;$i++){
      $newtitle = $newsongs[$i]["song"];
      echo $newtitle." - ";
      if($newtitle == ""){
          echo "NO NEW TAGS&lt;br /&gt;";
      }
      else{
          $title = $oldsongs[$i]["title"];
          echo $title."&lt;br /&gt;";
          $artist = $oldsongs[$i]["artist"];
          $album = $oldsongs[$i]["album"];
          $newartist = $newsongs[$i]["artist"];
          $newalbum = $newsongs[$i]["album"];
          $mbid = $newsongs[$i]["mbid"];          
          $insert = "UPDATE collection SET song='".$newtitle."', artist='".$newartist."', album='".$newalbum."', gille_id='".$mbid."' WHERE song='".$title."' AND artist='".$artist."' AND album='".$album."'";
          $results = $db-&gt;query($insert);         
          echo $insert."&lt;br /&gt;";      
      }
  }
  
  mysqli_close($db);
  
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>