Does anyone know how to get the autonumber value of a field e.g. Customer_ID from a customer table so that it can be used in another table eg Reservation? Is there a specific PHP function to get this auto_incremented value?? I was thinking about mysql_fetch_field but I'm not sure if this will get the actual VALUE rather just verifying that the field HAS an autonumber if you see what I mean. Thanks!
I assume you mean immediately after you have inserted something? For mysql, use use:
http://www.php.net/manual/en/function.mysql-insert-id.php
there is probably similar functions for other DB's
You can fetch the information from that field just like any other. If you tell the DB you are using I can give you some code to show you.
That would be great...I'm using mysql version 3.23.44. Tables customer, (CUSTOMER_ID as primary key) reservation, etc and I want to get the CUSTOMER ID automatically generated from the customer table and use it in the reservation table. Thanks :-)