june_c21 Posted October 20, 2007 Share Posted October 20, 2007 hi, how to write php code where i called values from table 1 (database) and insert to table 2 (database) ? thanks june Quote Link to comment https://forums.phpfreaks.com/topic/74051-php-mysql/ Share on other sites More sharing options...
june_c21 Posted October 20, 2007 Author Share Posted October 20, 2007 $month = $_POST ['month']; $gf = $_POST ['gf']; $equipment = $_Get ['equipment']; $query= "INSERT INTO report( month,gf,equipment) VALUES ('$month','1','$equipment') "; $result = mysql_query($query,$dblink); my problem is the month & gf are insert by users to report table but equipment is taken from different table and want to insert into report table. how to write the code? thanks Quote Link to comment https://forums.phpfreaks.com/topic/74051-php-mysql/#findComment-373853 Share on other sites More sharing options...
june_c21 Posted October 20, 2007 Author Share Posted October 20, 2007 i need help....... Quote Link to comment https://forums.phpfreaks.com/topic/74051-php-mysql/#findComment-373880 Share on other sites More sharing options...
steve448 Posted October 20, 2007 Share Posted October 20, 2007 If $equipment is taken from another table then you will need to do that sql query first and use the result as $equipment before your insert Quote Link to comment https://forums.phpfreaks.com/topic/74051-php-mysql/#findComment-373883 Share on other sites More sharing options...
june_c21 Posted October 20, 2007 Author Share Posted October 20, 2007 how to write the code for that? i still new with the query part. Quote Link to comment https://forums.phpfreaks.com/topic/74051-php-mysql/#findComment-374068 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.