Updating int4 field with multiple values

From: Date: Fri, 06 Dec 2002 16:56:49 +0000
Subject: Updating int4 field with multiple values
Groups: php.general 
Request: Send a blank email to php-general+get-127282@lists.php.net to get a copy of this message
I would like to update an int4 column with new values appended to the end (preferably with a delimiter such as @ or a comma). With PostgreSQl 7.2, I can't seem to add the number with a delimiter (it gives me a parser error at the delimiter). For example, If I update the field 'radd' that already has number 36 in it, it does append the new number, but without any space. So, if I updated with a new number, 6, the 'radd' result would now be '366' instead of '36 6' Without the delimiter, it might be difficult to do selects on this field when I need to find a specific number within the field. (Btw, I'm using $_SESSION['rid'] . . . etc instead of $rid in the actual code.) Any ideas what I'm doing wrong? Any suggestions will be greatly appreciated. ************************************************** Simplified code: </php . . . /* for simplicity set $new= 6 $new is int4 */ $new = 6; include("dbc.php"); $query = "UPDATE rap SET radd = radd||', $new' WHERE rid = '12'"; $result = pg_exec($db, $query); if (!$result) {print "What? Can't do what you're asking me!";} if ($result) {print "Record updated";} pg_close($db); . . . ?> Tia, Andre

« previous php.general (#127282) next »