Posted by Hendri Kurniawan on 01/05/07 23:06
mysql_insert_id()
See the manual for any pitfalls
Hendri Kurniawan
toodi4 wrote:
> Lets say you have a form that when saved to the mysql database creates
> a unique incremental id. The form is just the first part of a series
> of things the user can do, so once the ID is created, the page would
> need to know immediately what this ID is. Is there a way to grab this
> ID instantly once it is created? Obviously if this were a sign-up for
> and a new user name and password are involved, you can have the user
> login after the initial set up and this select statement would bring
> back the ID. But the situation I have doesn't work like that.
>
> The way I have been dealing with this is simply to have a select
> statement after the initial insert that requests the record based on a
> couple of other fields that are likely unique. But this seems like a
> rather kludgy way of doing it. Is there some other solution.
>
Navigation:
[Reply to this message]
|