Manipulating data with 2 tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux