Forums

PHP

This topic is locked

Next Autoindex

Posted 06 Nov 2001 23:34:18
1
has voted
06 Nov 2001 23:34:18 Stephen Bateman posted:
I am using PHP/Mysql with PKArk and have a table with a primary field of "user_id" which has the "auto increment" flag.

What I need to do find out what the "auto increment" value is when I insert the new record, so I can inform the user of their ID.

Thanks in advance.

GT

Replies

Replied 07 Nov 2001 11:35:08
07 Nov 2001 11:35:08 chief monkey replied:
Have a look at the
mysql_insert_id() function,

www.php.net/manual/en/function.mysql-insert-id.php
George



Everybody has got to be somewhere
Replied 08 Nov 2001 10:56:47
08 Nov 2001 10:56:47 Tim Green replied:
The MySQL insert_id function is fine, but there is actually support for this directly through ADODB, which also means that it is cross-compatible with all DBs that support this feature.

To use this you only need something like the following code:-

$nextID = $connection->Insert_ID();

Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 27 Jun 2002 22:26:33
27 Jun 2002 22:26:33 Mike Simmons replied:
how can i do this using asp and access97? please help.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
The MySQL insert_id function is fine, but there is actually support for this directly through ADODB, which also means that it is cross-compatible with all DBs that support this feature.

To use this you only need something like the following code:-

$nextID = $connection-&gt;Insert_ID();

Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

MIKE
Replied 29 Jun 2002 11:49:17
29 Jun 2002 11:49:17 Tim Green replied:
Mike,

In case you haven't noticed, this is a PHP Forum. Please post your question in the UltraDev forum where you are likely to get the right information.



Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic