RE: [PHP] REPLACE problem

From: Date: Wed, 03 Oct 2001 08:22:21 +0000
Subject: RE: [PHP] REPLACE problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69733@lists.php.net to get a copy of this message
> A quick look at the REPLACE syntax tells me that > > "REPLACE works exactly like INSERT, except that if an old record in the > table has the same value as a new record on a unique index, the old > record is deleted before the new record is inserted." > > So if id isn't a unique index, you could expect the values to be added. The id is a unique index. But - as often before. Asking something here triggers my brain to work. I found the problem. I simply forgot a comma in my query: $query .= " values('$fid''$show_id')"; I got a little disappointed at first when the query started adding additional values again. But it only did that one time. For some reason it wanted id to have a row with the value "0". After that it started to replace the row with id "1". And now it works :) - Daniel

« previous php.general (#69733) next »