jj20051 Posted July 8, 2010 Share Posted July 8, 2010 I'm getting the following 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 'create, auto_create, module, plan, product_id, invoice_identifier) VALUES ('', '' at line 1 When I try to run: mysql_query("INSERT INTO services (title, user_id, domain, server_id, setup_date, setup_id, next_due_date, first_amount, recurring_amount, cycle, suspended, active, setup_type, auto_create, reseller, product_id, plan, invoice_identifier) VALUES ('$title', '$user_id', '$domain', '0', '$today', '0', '$next_due_date', '$first_amount', '$recurring_amount', '$cycle', '2', '0', '$setup_type', '$auto_create', '$reseller', '$product_id', '$plan', '$invoice_identifier')"); I've looked it over multiple times and I can't seem to fix it. :'( :'( :'( Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/ Share on other sites More sharing options...
freelance84 Posted July 8, 2010 Share Posted July 8, 2010 Are you sure error relates to the script you entered? The error is saying: ...create, auto_create, module, plan, product_id, invoice_identifier) VALUES ( But your script is trying: ..._type, auto_create, reseller, product_id, plan, invoice_identifier) VALUES ( They should be the same Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/#findComment-1082937 Share on other sites More sharing options...
jj20051 Posted July 8, 2010 Author Share Posted July 8, 2010 It seems that your probably right... The query must be: mysql_query("INSERT INTO creation_quene (service_id, user_id, username, password, domain, email_address, created, reseller, create, auto_create, module, plan, product_id, invoice_identifier) VALUES ('$service_id', '$user_id', '$username', '$password', '$domain', '$email', '0', '$reseller', '$create', '$creation_quene', '$setup_type', '$plan', '$product_id', '$invoice_identifier')") or die(mysql_error()); but I still don't see the problem. I've literally looked over every letter. Its strange that I can't figure this out. Just for the record, 'quene' is how it ALWAYS appears in the database... If I didn't miss spell it I would have miss typed it eventually. Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/#findComment-1082942 Share on other sites More sharing options...
freelance84 Posted July 8, 2010 Share Posted July 8, 2010 In the query are all the field names in the same order as they appear in the table? Probably doesn't matter but as you are trying to eliminate any possible errors Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/#findComment-1082954 Share on other sites More sharing options...
PFMaBiSmAd Posted July 8, 2010 Share Posted July 8, 2010 The error message is telling you where mysql found something in your query that was out of place and could not be operated on - the right syntax to use near 'create, ... Create, as you might imagine, has special meaning to a database - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Either rename your column to something else or enclose it in back-ticks `` every time you put it in a query so that it will be treated as a column name instead of a keyword. Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/#findComment-1082996 Share on other sites More sharing options...
jj20051 Posted July 9, 2010 Author Share Posted July 9, 2010 Thank you helped alot Quote Link to comment https://forums.phpfreaks.com/topic/207111-help-with-a-php-mysql-query-problem-error/#findComment-1083419 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.