0

I am trying to insert a row into my table tutorial_info using the command:

$sql3 = "INSERT INTO tutorial_info(tutorial_id,tutorial_title,tutorial_author,submission_date)
         VALUES(NULL,"Math","Bob Trotter",CURRENT_TIMESTAMP);";

 if($conn->query($sql3)===TRUE){

     echo "Added data\n";

   }

    else echo "Could not add data to the table ".$conn->error;

The insert function is not working. I am not getting any error displayed at all.

$conn is my mysqli object. I have managed to get other queries working on $conn. I have also cut and paste

INSERT INTO tutorial_info(tutorial_id,tutorial_title,tutorial_author,submission_date)
             VALUES(NULL,"Math","Bob Trotter",CURRENT_TIMESTAMP);

directly into MySQL to confirm the syntax is correct and it works.

Any tips on what I might be doing wrong?

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
KexAri
  • 3,867
  • 6
  • 40
  • 80

0 Answers0