Jump to content

Help with a php mysql query problem - error


jj20051

Recommended Posts

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.  :'( :'( :'(

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

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.  :confused:

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.