title: PHP and Mysql error "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version"
body: <p>I am trying to code a little log thing for my Home automations script but then I got this error:</p>
  
  <p>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</p>
  
  <p>My SQL is: </p>
  
  <pre><code>INSERT INTO
      logsa (timeb, msg, actionb)
  VALUES 
      ('12-05-2018 02:29:38pm',
      'Succesfully send a trigger to https://maker.ifttt.com/trigger/test/with/key/xxxxxxxxxxxxxxxxxxxxxxxx With name test',
      'https://maker.ifttt.com/trigger/test/with/key/xxxxxxxxxxxxxxxxxxxxxxxx'
  </code></pre>
  
  <p>and my code is:</p>
  
  <pre><code>    $logmsg = ("Succesfully send a trigger to " . $row["actiona"] . " With name " . $row["namea"]);
  
      date_default_timezone_set("Europe/Stockholm");
  
      $date = date("d-m-Y");
      $time = date("h:i:sa");
      $fulldate = ($date . " " . $time);
  
      $actiona = $row["actiona"];
      $sql = "INSERT INTO logsa (timeb, msg, actionb)
      VALUES ('$fulldate', '$logmsg', '$actiona'";
  
      if ($conn-&gt;query($sql) === TRUE) {
          echo "New record created successfully";
      } else {
          echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
      }
  </code></pre>