RE: [PHP-DB] INSERT statement

2001-05-21 Thread Beau Lebens

try
INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1 = '$z'

quote marks around the $z
and make sure you are doing it as
query( "INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1
= '$z'" );
or whatever, using " marks properly :)

HTH

Beau

// -Original Message-
// From: Bartek Pawlik [mailto:[EMAIL PROTECTED]]
// Sent: Monday, 21 May 2001 4:54 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] INSERT statement
// 
// 
// Hi,
// 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:
// 
// Warning: PostgreSQL query failed: ERROR: parser: parse error 
// at or near "where" in file.php on line x
// 
// 
// Thanks in advance
// 
// Bartek Pawlik
// Poland
// 
// 
// 
// 
// 
// -- 
// 26 maja - Dzie Matki. Wygraj kwiaty dla swojej Mamy!
// Do rozdania 75 bukietw z dostaw i yczeniami.
// [ http://zakupy.onet.pl/prezenty.asp?k=7 ]
// 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] INSERT statement

2001-05-21 Thread Russ Michell

I don't use PostgresSQL, but the SQL can't be that different:

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1 = 
'$z' 

//Loose the brackets after the WHERE clause, and add single quotes 
//around your variable.
Russ

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = 
$z)  Php shows:
On Mon, 21 May 2001 10:54:05 +0200 Bartek Pawlik 
[EMAIL PROTECTED] wrote:

 Hi,
 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:
 
 Warning: PostgreSQL query failed: ERROR: parser: parse error at or near 
 where in file.php on line x
 
 
 Thanks in advance
 
 Bartek Pawlik
 Poland
 
 
 
 
 
 -- 
 26 maja - Dzieñ Matki. Wygraj kwiaty dla swojej Mamy!
 Do rozdania 75 bukietów z dostaw± i ¿yczeniami.
 [ http://zakupy.onet.pl/prezenty.asp?k=7 ]

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] INSERT statement

2001-05-21 Thread Miles Thompson

Bartek,

Saw all the other replies, and they are correct, but what you want now is 
an UPDATE, not an INSERT. You have the record, you are amending it.

Miles

At 10:54 AM 5/21/01 +0200, Bartek Pawlik wrote:
Hi,
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:

Warning: PostgreSQL query failed: ERROR: parser: parse error at or near 
where in file.php on line x


Thanks in advance

Bartek Pawlik
Poland





--
26 maja - Dzieñ Matki. Wygraj kwiaty dla swojej Mamy!
Do rozdania 75 bukietów z dostaw± i ¿yczeniami.
[ http://zakupy.onet.pl/prezenty.asp?k=7 ]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]