MySqli Insert Error on Multiple Insert
<p>So, I am using this bit of code to extract data from an XML file. When I attempt to do the insert, I get an error message. If I use the same output and to the INSERT in MySQL Workbench, it works fine. So I am assuming it's something in the way PHP is interpreting the data. Been banging my head against the wall, so any help is appreciated. Below is the code:</p>

<pre><code>&lt;?php

 $completeurl = "gps.kml";
 $xml = simplexml_load_file($completeurl);

 $placemarks = $xml-&gt;Document-&gt;Folder-&gt;Placemark;
 mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
 $con=mysqli_connect("localhost","root","V1ct0ry4439253","gps");
//Check connection
if (mysqli_connect_errno())
 {
 echo "Failed to connect to MySQL: " . mysqli_connect_error();
 }

$query = '';
$run='';
for ($i = 0; $i &lt; sizeof($placemarks); $i++) {
$coordinates = $placemarks[$i]-&gt;name;
 $cor_d  =  explode(' ', $placemarks[$i]-&gt;Point-&gt;coordinates);
 $qtmp=array();
 foreach($cor_d as $value){
      $tmp = explode(',',$value);
      $ttmp=$tmp[1];
      $tmp[1]=$tmp[0];
      $tmp[0]=$ttmp; 
      $qtmp= '' . $tmp[0] . '' .$tmp[1].'';
 }

$cor_d = $qtmp;
$query .='(\''.$coordinates.'\', \''.$cor_d.'\')';
$run .="INSERT INTO gps_history (name, coordinates) VALUES ".$query."";

//break;
 }
 echo $run;
 mysqli_query($con,$run);

mysqli_close($con);
 ?&gt;
</code></pre>