7 messages in com.mysql.lists.mysqlRe: Getting The Next Row ID?| From | Sent On | Attachments |
|---|---|---|
| Jonathan Wright (DjNA) | 16 Dec 2000 09:17 | |
| Bob Hall | 16 Dec 2000 14:09 | |
| Stephen Johnson | 16 Dec 2000 14:14 | |
| Jerome Abela | 19 Dec 2000 00:34 | |
| sean | 19 Dec 2000 10:22 | |
| sean | 19 Dec 2000 10:22 | |
| sean | 19 Dec 2000 10:22 |
| Subject: | Re: Getting The Next Row ID?![]() |
|---|---|
| From: | Stephen Johnson (mys...@pets4u.com) |
| Date: | 12/16/2000 02:14:26 PM |
| List: | com.mysql.lists.mysql |
on 12/16/00 9:17 AM, Jonathan Wright (DjNA) at ma...@djna.fsnet.co.uk wrote:
What I would like to do is to get the next row ID so available, and then use it to create the unique ID and then INSERT the information into the various tables using the unique ID as the link across them
Isn't this what the auto_increment definition does for you? I am not sure I understand the reasoning behind this
if you need to have the max id then do
select max(id) from table.
then I suppose you can add one and go from there -- the only problem then is that if you get a bunch of hits at one time then you are going to have people that get assigned the same value.
I may be completely missing the point of what you are trying to accomplish, but I think that the best idea is to have the auto_increment value for the main table create the idea and then retrieve that with the
$id = mysql_insert_id();
and use that value to link the rest of the tables.
I hope that this makes sense to you..
-- **** Stephen Johnson step...@pets4u.com http://www.pets4u.com Owner / Founder **** -- your next best friend is waiting for you --




