Jump to content

Archived

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

drranch

[fixed]Need help with insert syntax

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

Share this post


Link to post
Share on other sites
So is this solved?

Share this post


Link to post
Share on other sites
Yes. Thank you for asking...  That is why I put [fixed] in the summary and added the fix to the bottom of the post

Share this post


Link to post
Share on other sites
No problem.. I'm used to seeing "SOLVED".

Share this post


Link to post
Share on other sites

×

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.