Re: [PHP] Auto-increment value

2002-09-18 Thread Scott Houseman
Hi there. You can use the function mysql_insert_id( [link id] ). regards Scott Faisal Abdullah wrote: Hi people, I have a table with a column called ID (auto-increment). Is it possible to know the value of ID, right after inserting a row? I'm using postgresql. Thanks.

Re: [PHP] Auto-increment value

2002-09-18 Thread Erwin
Scott Houseman wrote: Hi there. You can use the function mysql_insert_id( [link id] ). I'm using postgresql. Not if you're using PostGreSQL Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Auto-increment value

2002-09-18 Thread Marek Kilimajer
As he uses postgresql, he should use *pg_last_oid()* Scott Houseman wrote: Hi there. You can use the function mysql_insert_id( [link id] ). regards Scott Faisal Abdullah wrote: Hi people, I have a table with a column called ID (auto-increment). Is it possible to know the value of

Re: [PHP] Auto-increment value

2002-09-18 Thread Justin French
not on postgreSQL :) Justin on 18/09/02 7:24 PM, Scott Houseman ([EMAIL PROTECTED]) wrote: Hi there. You can use the function mysql_insert_id( [link id] ). regards Scott Faisal Abdullah wrote: Hi people, I have a table with a column called ID (auto-increment). Is it possible

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
-- Sincerely, Faisal -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 5:42 PM To: PHP Subject: Re: [PHP] Auto-increment value As he uses postgresql, he should use *pg_last_oid()* Scott Houseman wrote: Hi there. You can use the function

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
insert/nextval(), before my select statement finishes processing? Would I get a 5? Sincerely, Faisal -Original Message- From: Faisal Abdullah [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 6:37 PM To: PHP Subject: RE: [PHP] Auto-increment value I tried that. It gives me

Re: [PHP] Auto-increment value

2002-09-18 Thread Marek Kilimajer
, September 18, 2002 6:37 PM To: PHP Subject: RE: [PHP] Auto-increment value I tried that. It gives me 24807, instead of 5. Or is oid is a reference to something else, which would lead me to the '5' i'm looking for? -- snip snip -- if($result = pg_exec($db, $sql)) { $query = success

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
Thanks for your reply, but I'm using postgresql. Mysql is irrelevant for me. -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 7:41 PM To: PHP Subject: Re: [PHP] Auto-increment value MySQL has |LAST_INSERT_ID() function, try

Re: [PHP] Auto-increment value

2002-09-18 Thread Leonid Mamtchenkov
Dear Faisal Abdullah, Once you wrote about RE: [PHP] Auto-increment value: Thanks for your reply, but I'm using postgresql. Mysql is irrelevant for me. There is a similar one for postgresql as well: pg_last_oid() . -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
There is a similar one for postgresql as well: pg_last_oid() . I tried that. It gives me 24807, instead of 5. Or is oid is a reference to something else, which would lead me to the '5' i'm looking for? -- snip snip -- if($result = pg_exec($db, $sql)) { $query = success;

RE: [PHP] Auto-increment value

2002-09-18 Thread bob parker
SELECT idno ORDER BY idno DESC LIMIT 1; assuming idno is what gets auto incremented bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Auto-increment value

2002-09-18 Thread Marek Kilimajer
You encounter a race condition bob parker wrote: SELECT idno ORDER BY idno DESC LIMIT 1; assuming idno is what gets auto incremented bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Auto-increment value

2002-09-18 Thread Jon Haworth
Hi Bob, SELECT idno ORDER BY idno DESC LIMIT 1; assuming idno is what gets auto incremented That's not the best idea - what happens if two users are inserting records into the table at nearly-but-not-quite the same time? 1. Insert A goes through 2. Insert B goes through 3. LastID A returns

RE: [PHP] Auto-increment value

2002-09-18 Thread bob parker
; charset=ISO-8859-1 Subject: RE: [PHP] Auto-increment value X-UIDL: *ab!\-5!!-$7!!nk~!! Hi Bob, SELECT idno ORDER BY idno DESC LIMIT 1; assuming idno is what gets auto incremented That's not the best idea - what happens if two users

Re: [PHP] Auto-increment value

2002-09-18 Thread Justin French
I tend to (if I can't use mysql_last_id) insert a unique key into the row, and pull the row out that matches that key, in order to get the ID... ensures that it was the right row... then you can delete the unique key. Justin on 18/09/02 10:27 PM, Jon Haworth ([EMAIL PROTECTED]) wrote: Hi

Re: [PHP] Auto-increment value

2002-09-18 Thread bob parker
From: Marek Kilimajer [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Subject: Re: [PHP] Auto-increment value You encounter a race condition bob parker wrote: SELECT idno ORDER BY idno DESC LIMIT 1; assuming idno is what gets auto incremented

Re: [PHP] Auto-increment value

2002-09-18 Thread Leonid Mamtchenkov
Dear Faisal Abdullah, Once you wrote about RE: [PHP] Auto-increment value: There is a similar one for postgresql as well: pg_last_oid() . I tried that. It gives me 24807, instead of 5. Or is oid is a reference to something else, which would lead me to the '5' i'm looking for? I'd bet

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
19, 2002 5:35 AM To: Faisal Abdullah Cc: Marek Kilimajer; PHP Subject: Re: [PHP] Auto-increment value Dear Faisal Abdullah, Once you wrote about RE: [PHP] Auto-increment value: There is a similar one for postgresql as well: pg_last_oid() . I tried that. It gives me 24807, instead of 5