how to execute two queries if isset
like this

but this code wont work

if (isset($_POST['Add'])){

$tror=$_POST['tror'];
$name=$_POST['name'];
$product=$_POST['product'];
$price=$_POST['price'];
$deliver=$_POST['deliver'];
$return=$_POST['return'];
$custody=$_POST['custody'];
$cash=$_POST['cash'];
$charge=$_POST['charge'];
$date=$_POST['date'];

mysql_query("insert into delivery (TrOr,Customers_Name,Product,Price,Deliver,xReturn,Custody,Cash,Charge,Date)
            values('$tror','$name','$product','$price','$deliver','$return','$custody','$cash','$charge','$date') ; UPDATE inventory set Quantity='$_POST[cquantity]' WHERE Product='$_POST[product]'");

}

Recommended Answers

All 6 Replies

Any errors?

nope but it wont execute it wont add

Change the semi-colon in between for a comma, make sure the column names in the first query are exactly the same as in mysql i.e same case throughout, mysql gets funny about that,
otherwise, just make the update a separate query. I'm also assuming that you have a connect earlier in the script, you don't show it.

@cereal, that's me working on sqlite for the last few months, got myself confused there!

@Tony I can understand, it happens also to me! ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.