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
https://forums.phpfreaks.com/topic/61832-solved-help-mysql-insert-query/
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

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

:(

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.