PDO SQL insert syntax issue : <p>I'm trying to get my page to insert multiple rows into my database at once. All info comes from a previous page. When a certain coordinate is entered, the row isn't saved.</p>

<p>While testing, just Alpha gets a coordinate that differs from the excluded coordinate.</p>

<p>When I run the code, I get the following error:</p>

<pre><code>SQLSTATE[42000]: Syntax error or access violation: 1064 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 ')' at line 2
</code></pre>

<p>This is my code:</p>

<pre><code>try {
                        $conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);

                        $dag = mysqli_real_escape_string($conn, $_GET['dag']);
                        $tijd = mysqli_real_escape_string($conn, $_GET['tijd']);

                        $wgs_coordinaat_x_alpha = mysqli_real_escape_string($conn, $_GET["x_alpha"]);
                        $wgs_coordinaat_y_alpha = mysqli_real_escape_string($conn, $_GET["y_alpha"]);
                        $wgs_coordinaat_x_bravo = mysqli_real_escape_string($conn, $_GET["x_bravo"]);
                        $wgs_coordinaat_y_bravo = mysqli_real_escape_string($conn, $_GET["y_bravo"]);
                        $wgs_coordinaat_x_charlie = mysqli_real_escape_string($conn, $_GET["x_charlie"]);
                        $wgs_coordinaat_y_charlie = mysqli_real_escape_string($conn, $_GET["y_charlie"]);
                        $wgs_coordinaat_x_delta = mysqli_real_escape_string($conn, $_GET["x_delta"]);
                        $wgs_coordinaat_y_delta = mysqli_real_escape_string($conn, $_GET["y_delta"]);
                        $wgs_coordinaat_x_echo = mysqli_real_escape_string($conn, $_GET["x_echo"]);
                        $wgs_coordinaat_y_echo = mysqli_real_escape_string($conn, $_GET["y_echo"]);
                        $wgs_coordinaat_x_foxtrot = mysqli_real_escape_string($conn, $_GET["x_foxtrot"]);
                        $wgs_coordinaat_y_foxtrot = mysqli_real_escape_string($conn, $_GET["y_foxtrot"]);

                        // set the PDO error mode to exception
                        $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

                        // begin the transaction
                        $conn-&gt;beginTransaction();
                        // our SQL statements
                        if ($wgs_coordinaat_x_alpha == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Alpha', '$wgs_coordinaat_x_alpha', '$wgs_coordinaat_y_alpha')");
                            }
                        if ($wgs_coordinaat_x_bravo == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Bravo', '$wgs_coordinaat_x_bravo', '$wgs_coordinaat_y_bravo'))");
                            }
                        if ($wgs_coordinaat_x_charlie == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Charlie', '$wgs_coordinaat_x_charlie', '$wgs_coordinaat_y_charlie')");
                            }
                        if ($wgs_coordinaat_x_delta == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Delta', '$wgs_coordinaat_x_delta', '$wgs_coordinaat_y_delta')");
                            }
                        if ($wgs_coordinaat_x_echo == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Echo', '$wgs_coordinaat_x_echo', '$wgs_coordinaat_y_echo')");
                            }
                        if ($wgs_coordinaat_x_foxtrot == "47.9747674834") {}
                            else {
                                $conn-&gt;exec("INSERT INTO markers (id, type, dag, tijd, deelgebied, lat, lng) 
                                VALUES (NULL, 'Hint', '$dag', '$tijd', 'Foxtrot', '$wgs_coordinaat_x_foxtrot', '$wgs_coordinaat_y_foxtrot')");
                            }   
                        // commit the transaction
                        $conn-&gt;commit();
                        echo "Hint succesvol toegevoegd!";
                        }
                    catch(PDOException $e)
                        {
                        // roll back the transaction if something failed
                        $conn-&gt;rollback();
                        echo "Opes! Iets is fout gegaan: " . $e-&gt;getMessage();
                        }

                    $conn = null;
</code></pre>

<p>I'm out of ideas. Thanks!</p>
