Как вставить данные из формы на несколько вкладок
У меня есть проблема, мой код не вставляет данные в несколько таблиц, он вставляет только в одну таблицу, а остальные я не вставляю.
Что я уже пробовал:
//this is the main include('database.php'); include ('functions.php'); if(isset($_POST['save'])) { $name = mysqli_real_escape_string($con,$_POST['name']); $surname = mysqli_real_escape_string($con,$_POST['surname']); $phone = mysqli_real_escape_string($con,$_POST['phone']); $email = mysqli_real_escape_string($con,$_POST['email']); $address = mysqli_real_escape_string($con,$_POST['address']); $sn = mysqli_real_escape_string($con,$_POST['sn']); $inv = mysqli_real_escape_string($con,$_POST['inv']); $reseller = mysqli_real_escape_string($con,$_POST['reseller']); $price = mysqli_real_escape_string($con,$_POST['price']); $tbPrice = mysqli_real_escape_string($con,$_POST['oprice']); $resdate = mysqli_real_escape_string($con,$_POST['rdate']); $tbDate = mysqli_real_escape_string($con,$_POST['tdate']); $itemName = mysqli_real_escape_string($con,$_POST['item']); //calling function to run query multiquery($name,$surname,$phone,$email,$address,$sn,$tbPrice,$tbDate,$inv,$resdate,$itemName,$price,$reseller); /*insertClientInfo($name,$surname,$phone,$email,$address); InsertSales($sn,$tbPrice,$tbDate,$inv,$resdate); insertItem($sn,$itemName,$price);*/ } //this is the function function multiquery($name,$surname,$phone,$email,$address,$sn,$thaboPrice,$thaboSoldDate,$invNum,$rsoldDate,$itemName,$price,$reseller) { include('database.php'); $sql = "INSERT INTO client(name,surname,phone,email,address) VALUES('$name','$surname','$phone','$email','$address');"; $sql =$sql ."INSERT INTO client_item(puch_id,client_id,serial_no,tb_price,t_date,res_date) VALUES($invNum,(SELECT client_id FROM client WHERE name ='$name'),'$sn',$thaboPrice,'$thaboSoldDate','$rsoldDate');"; $sql = $sql ."INSERT INTO item(serial_no,item_name,price,Reseller_id) VALUES('$sn','$itemName',$price,(SELECT Reseller_id FROM reseller WHERE ResellerName ='$reseller'));"; if(mysqli_multi_query($con,$sql)) { echo "Successfuly INSERTED"; } else{ echo "Failed to insert info". mysqli_error($con); } }