[PHP] Updating int4 field with multiple values

2002-12-06 Thread Andre Dubuc
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Updating int4 field with multiple values

2002-12-06 Thread Jason Wong
On Saturday 07 December 2002 00:56, Andre Dubuc wrote:
 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.

Am I missing something or are you really trying to insert non-digits into an 
INTEGER field?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
A compliment is something like a kiss through a veil.
-- Victor Hugo
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Updating int4 field with multiple values

2002-12-06 Thread 1LT John W. Holmes
 I would like to update an int4 column with new values appended to the end
 (preferably with a delimiter such as @ or a comma).

  in·te·ger( P )  Pronunciation Key  (nt-jr)
  n. Mathematics
1.. A member of the set of positive whole numbers 1, 2, 3,... ,
negative whole numbers -1, -2, -3,... , and zero {0}.
2.. A complete unit or entity.


---John Holmes...



Re: [PHP] Updating int4 field with multiple values

2002-12-06 Thread Andre Dubuc
Hi Jason,

So, I gather from your reply that I cannot add more digits to that integer 
field separated by spaces or whatever?  I sort of figured I won't be able to 
do it, so I'm trying to get things working by changing the type to varchar() 
and doing it as a string. Seems to work - with glitches.



An

On Friday 06 December 2002 01:39 pm, you wrote:
 On Saturday 07 December 2002 00:56, Andre Dubuc wrote:
  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.

 Am I missing something or are you really trying to insert non-digits into
 an INTEGER field?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Updating int4 field with multiple values

2002-12-06 Thread Andre Dubuc
de-ja vu   (P)  Pronunciation Key (du hhh)
n . Foreign
1. Something unpleasantly familiar
2. 'Been-there-done-that'

Don't you love it when you've set a field to a certain type, only to find out 
much later, after much coding, it's wrong?

Thanks for the reminder. Guess it's back to Geek 1.0.1 for me.

Regards,
Andre



On Friday 06 December 2002 03:31 pm, 1LT John W. Holmes wrote:
  I would like to update an int4 column with new values appended to the end
  (preferably with a delimiter such as @ or a comma).

   in·te·ger( P )  Pronunciation Key  (nt-jr)
   n. Mathematics
 1.. A member of the set of positive whole numbers 1, 2, 3,... ,
 negative whole numbers -1, -2, -3,... , and zero {0}.
 2.. A complete unit or entity.


 ---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php