Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Curt Zirzow
* Thus wrote Jay Blanchard: > [snip] > i've got a strange problem with a MySQL table. although my 'id' column > is set to 'auto_increment', each new record i insert has the value 1. > (instead of 1, 2, 3, etc.) > > i checked my sql statement and i'm not assigning the id value by > mistake. here is

Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread barophobia
On Mon, 12 Jul 2004 15:36:20 -0500, Jay Blanchard <[EMAIL PROTECTED]> wrote: > The guys on the MySQL list do. Have you read this--> > http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html not for this issue no. the problem for those that read this later is not that i am using multiple pr

Re: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Justin Patrin
Your primary key should be only (`id`). On Mon, 12 Jul 2004 13:04:19 -0700, barophobia <[EMAIL PROTECTED]> wrote: > hello. > > i've got a strange problem with a MySQL table. although my 'id' column > is set to 'auto_increment', each new record i insert has the value 1. > (instead of 1, 2, 3, etc.

RE: [PHP] auto-increment not working?? MySQL

2004-07-12 Thread Jay Blanchard
[snip] i've got a strange problem with a MySQL table. although my 'id' column is set to 'auto_increment', each new record i insert has the value 1. (instead of 1, 2, 3, etc.) i checked my sql statement and i'm not assigning the id value by mistake. here is my create statement (showing only a few c

RE: [PHP] auto increment

2004-02-17 Thread Chris Shiflett
--- "Chris W. Parker" <[EMAIL PROTECTED]> wrote: > > If the id is auto increment, can't you use max(id) to get the last > > inserted one? > > only if you are the absolute only person that will ever be connected to > that db at one time. otherwise the answer is no. > > what if in between your INSE

RE: [PHP] auto increment

2004-02-17 Thread Chris W. Parker
BAO RuiXian on Tuesday, February 17, 2004 11:32 AM said: > If the id is auto increment, can't you use max(id) to get the last > inserted one? only if you are the absolute only person that will ever be connected to that db at one time. otherwise the answer is no. wh

Re: [PHP] auto increment

2004-02-17 Thread BAO RuiXian
marc serra wrote: Hi, i use PEAR DB with a mysql database and i want to know if there is a solution to get last inserted id in a table. If the id is auto increment, can't you use max(id) to get the last inserted one? Best Bao I see that I can use sequences but it doesn't work with mysq

RE: [PHP] auto increment

2004-02-17 Thread Peter Billen
execute the following query: SELECT LAST_INSERT_ID(); Peter -Original Message- From: marc serra [mailto:[EMAIL PROTECTED] Sent: dinsdag 17 februari 2004 20:17 To: [EMAIL PROTECTED] Subject: [PHP] auto increment Hi, i use PEAR DB with a mysql database and i want to know if there is

Re: [PHP] auto increment

2004-02-17 Thread Chris Shiflett
--- marc serra <[EMAIL PROTECTED]> wrote: > i use PEAR DB with a mysql database and i want to know if there is a > solution to get last inserted id in a table. > > I see that I can use sequences but it doesn't work with mysql. There is this: http://www.php.net/mysql_insert_id Hope that helps.

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

RE: [PHP] Auto Increment Problems....

2002-07-29 Thread cteubner
-Original Message- >From: Georgie Casey [mailto:[EMAIL PROTECTED]] >Apart from this looking ugly, it poses another problem. In my PHP script >where I can add new rows, I query the table, checking how many rows in the >table altogether and set the new id as the next number, but this doesnt

Re: [PHP] auto increment

2001-09-07 Thread Martín Marqués
On Vie 07 Sep 2001 19:01, [EMAIL PROTECTED] wrote: > you know how, if you make a field a primary key and have it auto > increment... then if you delete an entry and add a new one it makes the > field 2 instead of 1... i know thats explained bad but do you know what i > mean? is there a way to make