I am trying to insert some information into the database but it is not working. The following is my code:
$sql4 = "INSERT INTO favorites (posted-date,posted-time,posted-
datetime,journalid, by) VALUES ('test','test','test','test','test')";
Try
$sql4 = "INSERT INTO `favorites` (`posted-date`,`posted-time`,`posted-datetime`,`journalid`, `by`) VALUES ('test','test','test','test','test')";
Also check if you are connecting to your database correctly.
And have a look at your table and all the fields if they are of correct type and exists.
It finally worked. I still did not figure out the cause of the error, but the following is the working code:
$sql4 = "INSERT INTO favorites
( id
, posted-date
, posted-time
, posted-datetime
, journalid
, by
) VALUES ( NULL , 'test', 'test', 'test', 'test', 'test' )";