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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.