What I usually do is do a SELECT COUNT(user_primary_key_column_name) and
count the number of rows - then I'll know what the last autonumber added
was.
A more accurate way is to do your INSERT statement, then follow it
immediately with a SELECT
select uid,name,address1,phone from users where name = '$name', address1 =
'$address1', phone = '$phone'
or whatever
then you can retrieve the value of uid for your address INSERT.
hth
Dave
currently been here 16 hours...and counting
ZZZZZzzzzzzzzzz
-----Original Message-----
From: Brian Weisenthal [mailto:[EMAIL PROTECTED]]
Sent: 26 July 2001 14:53
To: [EMAIL PROTECTED]
Subject: [PHP-DB] simple database question
ok this should be an easy one, i am just blanking on it here.
i want to link two tables together, a user table and address table. i create
the user entry first, then create the address entry. after creating the
address entry how do i get the auto_id that was entered in to enter it into
the user table? there is no unique field in the address table. any ideas?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]