Hello Everyone!
In one HTML form, when I enter voucherno so why it is not going to another table automatically because they have same voucherno column.
I want to insert data into two database table using PHP. Is there any solution for multiple table data insertion?
I created two tables in MYSQL. I have the same column name in both tables. I need a solution for insert data into multiples tables using PHP and MYSQL database
My first MYSQL database table structure.
This is Table 1 having column voucherno as connect to another table &
Second table columns -
That is table 2 having the same voucherno .
I tried this insert code for multiple tables -
//insert data to database
$result = mysqli_query($cser, "INSERT INTO voucher_i(type,voucherno,date),voucher_m(voucherno) VALUES('$type','$Voucherno','$Date')");
$query1 = "INSERT INTO voucher_i(type,voucherno,date) VALUES('$type','$Voucherno','$Date')";
$query2 = "INSERT INTO voucher_m(voucherno) VALUES('$Voucherno')";
mysqli_query($query1, $cser);
mysqli_query($query2, $cser);
if($result){
header("location:Combined.php");
I edited it. When I applied the below query then the result is stored in the database table like this
The data is showing me like this -
When I enter submit data in the next form the data are---