title: Executing MySQL Query from PHP error
body: <p>This part of my code creates a multiple query by this:</p>
  
  <pre><code>$sql = "";
  
  $sql .= "INSERT INTO projects
          (project_id, project_name, project_description, project_deadline, project_status, project_priority)
          VALUES ('" . $project_id . "', '" . $name . "', '" . $description . "', '" . $final_deadline . "', '" . $status . "', '" . $priority . "');";
  
  foreach($assignments as $assigned_user)
  {
      $sql .= "INSERT INTO assignments 
               (user_id, project_id, assigned_date) 
               VALUES ('" . $assigned_user . "', '" . $project_id . "', '" . time() . "');";
  }
  
  $result = mysql_query($sql) or die(mysql_error());
  </code></pre>
  
  <p>However, I get an error:</p>
  
  <blockquote>
    <p>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 'INSERT INTO assignments (user_id, project_id, assigned_date) ' at line 3</p>
  </blockquote>
  
  <p><em>However</em>, if I echo <code>$sql</code> it turns out something like this:</p>
  
  <pre><code>INSERT INTO projects (project_id, project_name, project_description, project_deadline, project_status, project_priority) VALUES ('7090', 'Sup :D', 'OMG!', '716770800', '1', '1');
  INSERT INTO assignments (user_id, project_id, assigned_date) VALUES ('12', '7090', '1284139311');
  INSERT INTO assignments (user_id, project_id, assigned_date) VALUES ('11', '7090', '1284139311');
  </code></pre>
  
  <p>THEN I manually execute the SQL into PhpMyAdmin, it works fine, but how come it doesn't work when PHP executes it and outputs an error?</p>