Jump to content

[SOLVED] help mysql insert query


tomasd

Recommended Posts

Hi,

I'm trying to add some data to my table.

 

I'm trying to insert into table "dev", column "Jul_25_07" a variable "$price" in the row where column "flight" is equals to variable "$time"

 

something like this:

$sql_insert = "INSERT INTO dev (Jul_25_07) VALUES ('$price') WHERE flight = $time";

 

what is the correct syntax to use?

Link to comment
Share on other sites

I've tried the following:

mysql> INSERT INTO dev (Jul_25_07) VALUES ('99.99') WHERE flight = 2007-01-12 09:35:00;
ERROR 1064 (42000): 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 'WHERE flight = 2007-01-12 09:35:00' at line 1

My flight column type is datetime

Link to comment
Share on other sites

Hi,

mysql> INSERT INTO dev (Jul_25_07) VALUES ('99.99') WHERE flight = '2007-01-12 09:35:00' ;
ERROR 1064 (42000): 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 'WHERE flight = '2007-01-12 09:35:00'' at line 1

:(

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.