I'm getting the following error and have no idea what is wrong: "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 'use, location, guardian, dateremoved, expectedreturndate, actual" Here is my line of code: $query = "INSERT INTO cca_assembly(description, partno, itemno, serno, barcode, manu, manupartno, manuserno, use, location, guardian, dateremoved, expectedreturndate, actualreturndate, notes) VALUES ('$desc', '$pno', '$ino', '$sno', '$brcd', '$mnu', '$mnupno', '$mnusno', '$iuse', '$loc', '$grdn', '$datermvd', '$exreturndate', '$actreturndate', '$ntshstry')"; Code (markup):
use is a reserved word you need to wrap it in backticks (Ithink that's what their called) like this INSERT INTO cca_assembly (description, partno, itemno, serno, barcode, manu, manupartno, manuserno, `use`, location, guardian, dateremoved, expectedreturndate, actualreturndate, notes) VALUES ('$desc', '$pno', '$ino', '$sno', '$brcd', '$mnu', '$mnupno', '$mnusno', '$iuse', '$loc', '$grdn', '$datermvd', '$exreturndate', '$actreturndate', '$ntshstry') Code (sql):
Also make sure that you are using addslashes if those variables are coming from a form as that will cause errors with things like " elkiwi's "
Thanks guys, i just changed the name, the error is now gone, however i'm now getting this: Unknown column 'usesearchtype' in 'field list'
$query = "INSERT INTO cca_assembly(description, partno, itemno, serno, barcode, manu, manupartno, manuserno, usesearchtype, locsearchtype, grdnsearchtyp, dateremoved, expectedreturndate, actualreturndate, notes) VALUES ('$desc', '$pno', '$ino', '$sno', '$brcd', '$mnu', '$mnupno', '$mnusno', '$iuse', '$loc', '$grdn', '$datermvd', '$exreturndate', '$actreturndate', '$ntshstry')"; Code (markup):
Well, even the smartest of programmers make stupid mistakes. This checklist might be helpful for avoiding such mistakes.