PHP: Insert data from form and another table in the same table

Wednesday, November 4, 2015

I want insert data from form and another table where inv_id = "'.$inv.'" in the same table "history" ($inv is data input from form) (sorry for my bad english)



Actually my query:



$query2 = "INSERT INTO istoric SET id_user = '".$user."',id_equipment = '".$nr_inv."',start = '".$startdate."',end = '".$enddate."',comment = '".$comment."'"; 
$id = "INSERT INTO `istoric`(`condition`) SELECT `status` FROM `echipament`WHERE `nr_inventar` = '".$nr_inv."'";


How to combine two query? Now this query insert data in two rows different.
Imagine with history table: link

0 comments:

Post a Comment