RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
chenkov [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 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 postgresq

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 m

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

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 Bob

RE: [PHP] Auto-increment value

2002-09-18 Thread bob parker
653.19) Content-Type: text/plain; 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 increm

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 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 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 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 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:

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, t

Re: [PHP] Auto-increment value

2002-09-18 Thread Marek Kilimajer
gt;-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 24807, instead of 5. >Or is oid is a reference to something

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
ther user/session does another 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 val

RE: [PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
d($result); } -- snip snip -- 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 wrot

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). >

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 k

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 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. >

[PHP] Auto-increment value

2002-09-18 Thread Faisal Abdullah
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. Sincerely, Faisal __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe