aquanuke Posted September 1, 2011 Share Posted September 1, 2011 mysql_query("INSERT INTO invoices ( client, date, domains, items, each, cost, status) VALUES('$custom', '$date', '$item_number Domain Credits', '1', '$mc_gross', '$mc_gross', 'PAID' ) ") or die(mysql_error()); gives me 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 'each, cost, status) VALUES('admin', '2011-09-01', '10 Domain Credits', '1', '15'' at line 2 Using crimson editor the fields im selecting 'date' and 'each' are in red. Are they not allowed? me thinking out loud Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 1, 2011 Share Posted September 1, 2011 each is a MySQL reserved word. Quote Link to comment Share on other sites More sharing options...
aquanuke Posted September 1, 2011 Author Share Posted September 1, 2011 Thanks thats what I thought, so is there a way to escape it like enclose the fields? I cant change the db fields as this table has been in use for about 7 years and tons of references to it elsehwere in other scripts. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 1, 2011 Share Posted September 1, 2011 Enclose it in `backticks` in the query string. Quote Link to comment Share on other sites More sharing options...
aquanuke Posted September 1, 2011 Author Share Posted September 1, 2011 Thank you ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.