title: SQL syntax error with DELETE query
body: <p>I'm working on a website connected to a database managed by MySQL. These are the structures of tables <em>pagamenti</em> and <em>prenotazione</em>:</p>
  
  <p><strong>Pagamenti</strong></p>
  
  <p><a href="https://i.stack.imgur.com/pmEjr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pmEjr.png" alt="table_pagamenti"></a></p>
  
  <p><strong>Prenotazione</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Nmr5c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nmr5c.png" alt="table_prenotazione"></a></p>
  
  <p>In my PHP code I want to delete a record from both tables using the field <code>IDPrenotazione</code>. I could use two different queries, as in the following code</p>
  
  <pre><code>$query1 = "DELETE FROM pagamenti WHERE IDPrenotazione='$ID'";
  $query2 = "DELETE FROM prenotazione WHERE IDPrenotazione='$ID'";
  </code></pre>
  
  <p>but it would be much better if I use only one query. I've learned that in SQL language queries are separated by <code>;</code>, so I tried this code</p>
  
  <pre><code>$query = "DELETE FROM pagamenti WHERE IDPrenotazione='$ID';
            DELETE FROM prenotazione WHERE IDPrenotazione='$ID'";
  </code></pre>
  
  <p>but it returns this error</p>
  
  <pre><code>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELETE FROM prenotazione WHERE IDPrenotazione='2017-0006'' at line 1
  </code></pre>
  
  <p>This is the complete code, with the execution</p>
  
  <pre><code>$query = "DELETE FROM pagamenti WHERE IDPrenotazione='$ID';
            DELETE FROM prenotazione WHERE IDPrenotazione='$ID'";
  if (mysqli_query($connessione, $query))
  {
      //code
  }
  else
  {
      echo mysqli_error($connessione);
  }
  </code></pre>
  
  <p>If I execute this code on phpMyAdmin it works as I want with no errors, so the query must be correct.</p>
  
  <p>Why doesn't it work via PHP? How can I make it work?</p>