Hi,

You can use the function mysql_insert_id(MYSQL *mysql) and add 1 to the
result.

If you want an SQL approach, you might want to use SELECT MAX(your_auto_inc)
FROM your_table

Regards
Jorge

MySQL Development Team
    __  ___     ____ __   __
   /  |/  /_ __/ __/ __ \/ /   Jorge del Conde <[EMAIL PROTECTED]>
  / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\____/ Mexico City, Mexico
        <___/



----- Original Message -----
From: "Alans" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 9:41 AM
Subject: ID/number of last item submittedto database


> Hi.
>
> I have a database where information is submitted to.
> On the submit page I want to show the ID number of next 'thing' to be
> submitted.
> I use auto increment for the ID.
> There must be some way of asking what the last ID number was (I can then
add
> one to this)
>
> is there a function for this? or do I have to get all IDs and parse out
the
> last one?
>
> Thanks.
>
> alan
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to