Question: I am trying to update a database through a PHP script with the following SQL: $insertSQL = ALTER TABLE `nmc_records` ('recordID', 'recordTitle', 'recordYear', 'pubID', 'catID',

I am trying to update a database through a PHP script with the following SQL:

$insertSQL = "ALTER TABLE `nmc_records` ('recordID', 'recordTitle', 'recordYear', 'pubID', 'catID', 'recordPrice') VALUES ('$recordID', '$recordTitle', '$recordYear', '$recordPublisher', '$recordCategory','$recordPrice')"; 

However I keep getting an error saying: "Error: ALTER TABLE `nmc_records` ('recordID', 'recordTitle', 'recordYear', 'pubID', 'catID', 'recordPrice') VALUES ('', '', '', '', '','') 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 '('recordID', 'recordTitle', 'recordYear', 'pubID', 'catID', 'recordPrice') ' at line 1"

What is the problem with my code and how can it be fixed to function correctly and update the database?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!