Manipulating data with 2 tables

From: Date: Sun, 27 Apr 2003 03:30:22 +0000
Subject: Manipulating data with 2 tables
Groups: php.db 
Request: Send a blank email to php-db+get-27386@lists.php.net to get a copy of this message
I have 2 tables I want to work with, 1. shipping_address 2. billing_address When a user registers, I first create their username/password profile and assign them an auto_incremented id via get_insert_id(); Next step is to record their shipping/billing_information. I thought I could do this by simply INSERT INTO shipping_address, billing_address SET shipping_address.address = $saddress, shipping_address.city = $scity, shipping_address.state = $sstate, billing_address.address = $baddress,billing_address.city=$bcity,billing_address.state=$bstate,billing_address.user_id=$user_id; It doesn't work. Need help on that. Next, how will I be able to select the data? is it SELECT * FROM shipping_address, billing_address WHERE user_id = $user_id; and if so, how do I handle the result? while($rows = mysql_fetch_array()) or $fields = mysql_fetch_array(); and then what? echo $fields['address'] etc.. but both tables have fields called address should I have named them differently? Thanks in advance...

« previous php.db (#27386) next »