* 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 my
[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
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.)
i
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
--- 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.
Chris
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
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
BAO RuiXian mailto:[EMAIL PROTECTED]
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.
what
--- 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 INSERT INTO
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.
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
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
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
--
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
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
, 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
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
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
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;
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
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
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
;
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
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
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
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
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
-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
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 it
29 matches
Mail list logo