Jump to content

[fixed]Need help with insert syntax


drranch

Recommended Posts

I would like to insert into my Mysql database information related to the logged in user....

here is the code I created, but there are problems....

("INSERT INTO cars (name, registered, registry_id, make, color, markings, mfg_date, purchase_price, purchase_date, sell_price, sell_date, addnotes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) WHERE username='{$_SESSION[loginUsername]}'"


Problems:
[list]
[*]If I remove the WHERE statement data is inserted in the cars table, but its not tied to the logged in user ID and username
[*]If I use the WHERE statment I get this message - You have an error in your SQL syntax
[/list]

Any thoughts/ and education would be great to get me over this hump :-\

FIXED - ("INSERT INTO cars (username, name, registered, registry_id, make, color, markings, mfg_date, purchase_price, purchase_date, sell_price, sell_date, addnotes) VALUES ('{$_SESSION[loginUsername]}', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" ;D
Link to comment
https://forums.phpfreaks.com/topic/19095-fixedneed-help-with-insert-syntax/
Share on other sites

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.