Page 1 of 1

query from one table and insert result into another table

Posted: Fri Nov 29, 2002 1:12 am
by ktell
Would appreciate help with the following php/mysql combination:
Trying to use the form variables submitted by user form to extract the correct state_pair_price from the state_pair table, example:
<? Select state_pair_price from state_pair where origin_state=$origin_state AND destination_state=$destination_state;

Next in the same script, I would like to insert the state_pair_price result from above into the field named price in a different table named email_quotes, example:
Insert state_pair_price into email_quotes.price;
?>

Both tables above reside in same database.

Any help would be appreciated.

Posted: Fri Nov 29, 2002 1:20 am
by volka
you don't have to store the values locally, mysql can handle that internally (if you like ;) )
http://www.mysql.com/doc/en/INSERT_SELECT.html