SELECT LAST_INSERT_ID AND SAVE TO VARIABLE

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

carlo2837
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Jan 25, 2013 2:40 am

SELECT LAST_INSERT_ID AND SAVE TO VARIABLE

Postby carlo2837 » Sun Jun 09, 2013 5:50 am

Hi I am creating an hotel reservation site for a friend.I found a nice tutorial on html.it and the code runs fine from the command line, no problem. Now I need to build an interface say to insert clients's data. So I have a form.My problem is that for the site to work I need to save last_insert_id to a variable called @codCliente.Can somebody just write for me that line of code so that I can insert it in the php file that handles the form? Please don't send me to some url looking for the answer, I've tried them all. Thank you.
P.S:If you need the whole code please let me know.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: SELECT LAST_INSERT_ID AND SAVE TO VARIABLE

Postby johnj » Sun Jun 09, 2013 8:55 am

take a look at the example on this page, what you need is shown as an example:
http://php.net/manual/en/function.mysql-insert-id.php


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest