title: Error SQL create temp table with php
body: <p>I try to select multiple values from a table, playlist_generate, with a condition, create a temp table, update a field and than insert in my table</p>
  
  <pre><code>$data_tabella_duplicata = $_POST['data_duplicata'];
  $data_iniziale_originale = $_GET['data_iniziale'];
  
  $query_duplica_playlist = "
  DROP TABLE IF EXISTS temp_table;
  CREATE TEMPORARY TABLE temp_table LIKE playlist_generate;
  SELECT data_playlist, giorno_playlist, orario_playlist, nome_evento,nome_programma FROM playlist_generate WHERE data_playlist = '".$data_iniziale_originale."';
  UPDATE temp_table SET data_playlist='".$data_tabella_duplicata."';
  INSERT INTO playlist_generate SELECT null,data_playlist, giorno_playlist,orario_playlist, nome_evento, nome_programma FROM temp_table;
  DROP TABLE temp_table;
  ";
  
  $esegui_query_duplica_playlist = $connessione-&gt;query($query_duplica_playlist);
  if ($connessione-&gt;error) {
  try {
      throw new Exception("MySQL error $connessione-&gt;error &lt;br&gt; Query:&lt;br&gt; $query_duplica_playlist", $connessione-&gt;errno);
  } catch (Exception $e) {
      echo "Error No: ".$e-&gt;getCode()." - ".$e-&gt;getMessage()."&lt;br &gt;";
      echo nl2br($e-&gt;getTraceAsString());
  }
  }
  </code></pre>
  
  <p>but i have an error I don't understand</p>
  
  <blockquote>
    <p>Error No: 1064 - MySQL error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TEMPORARY TABLE temp_table LIKE playlist_generate; SELECT data_playlist, ' at line 2 </p>
  </blockquote>
  
  <p>I try the code in phpmyadmin and it works</p>
  
  <p>if I use this</p>
  
  <pre><code>$query_duplica_playlist = "
  DROP TABLE IF EXISTS temp_table;
  CREATE TEMPORARY TABLE temp_table ENGINE = MEMORY;
  SELECT data_playlist, giorno_playlist, orario_playlist, nome_evento,nome_programma FROM playlist_generate WHERE data_playlist = '".$data_iniziale_originale."';
  UPDATE temp_table SET data_playlist='".$data_tabella_duplicata."';
  INSERT INTO playlist_generate SELECT null,data_playlist, giorno_playlist,orario_playlist, nome_evento, nome_programma FROM temp_table;
  DROP TABLE temp_table;
  ";
  
  $esegui_query_duplica_playlist = $connessione-&gt;multi_query($query_duplica_playlist);
  </code></pre>
  
  <p>I have no result</p>