when i search a value from text box, i want to check if proname not available in product table want to insert a new data to the table. and also update the stock table and stockrecieve table.i will display my code here
$invoice = $_POST['invoice'];
$date = $_POST['invdate'];
$product = $_POST['product'];
$qty = $_POST['quantity'].' '.$_POST['measure'];
$buy = $_POST['buyprice'];
$sell = $_POST['sellprice'];
$sql = "INSERT INTO stockrecieve (invoice, invdate, product_name, qty, buy_price, sellprice) VALUES ('$invoice','$date','$product','$qty','$buy','$sell')";
if ($mysqli->query($sql) === TRUE) {
}
else {
echo "Error: ".$sql."
".$mysqli->error;
".$mysqli->error;
}
$sql1 = "INSERT INTO stock (st_date, procode, sellprice, quantity) VALUES ('$date','$product','$sell','$qty')";
if ($mysqli->query($sql1)=== TRUE){
echo "";
}
}
?>