title: Error: You have an error in your SQL syntax; near ')' at line 1
body: <p>Im having a problem with my PHP code, it says the error is "Error: 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 ')' at line 1"</p>
  
  <p>It connects to the database ok as it echos "Database Connection Successful" but it dosnt insert the data into the database. This worked fine before, but now all of a sudden its stopped working. Can anyone help?</p>
  
  <pre><code>&lt;?php   
  $username = "student";
  $password = "student";
  $hostname = "localhost"; 
  $db       = "details";
  $link = new mysqli($hostname, $username, $password, $db);
  
   if ($link-&gt;connect_errno)
      printf("Connect failed: %s\n", $link-&gt;connect_error);
   else 
      echo "Database Connection Successful \n";
  
   echo nl2br("\n");
  
   $Urgency = "Urgency";
  
  if(isset($_POST['submit'])){
    $TypeOfProblem = $_POST['problemtype'];
    $ProblemDescription = $_POST['problem'];
    $RoomNo = $_POST['roomno'];
    $Problem = $_POST['reporter'];
    $Urgency = $_POST['Urgency'];
    $Date = $_POST['date'];
  
   //Insert into Database
    $sql = "INSERT INTO `details`.`problem` (`Type Of Problem`, `Problem Description`, `RoomNo`, `Urgency`, `UserIDProblem`,`Date` ) VALUES ('$TypeOfProblem', '$ProblemDescription', '$RoomNo', '$Urgency', '$Problem', $Date)";
  
  if (!mysqli_query($link, $sql))
         {
         die('Error: ' . mysqli_error($link));
         }
  
       echo "\n Thank you. Your Helpdesk Call has been submitted.";
  
      mysqli_close($link);
  
  }//////// end isset submit if ////////
   ?&gt;
  </code></pre>
  
  <p>Thanks</p>