RE: [PHP-DB] INSERT statement
| From: | Craig Vincent | Date: | Mon, 21 May 2001 09:43:10 +0000 |
| Subject: | RE: [PHP-DB] INSERT statement | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9491@lists.php.net to get a copy of this message | ||
<snip>
I have problem with INSERT statement in PostgresSQL v.7.0.3.
In one script I insert values in column1,column3,column5.
Later I want to fill column2 and column4.
I use
INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = $z)
Php shows:
</snip>
INSERT can't contain a WHERE clause as INSERT is used to create a new row,
not update a current row. The UPDATE command is more I think what you're
wanting.
UPDATE table SET column2 = '$x', column4 = '$y' WHERE column1 = '$z'
Try that and see what it does for you.
Sincerely,
Craig Vincent