hi all,
The following is what i want to to achieve;
When the user clicks a button
The requistion table should be updated.
The store table records should be updated with values from the requisitionitems
table and the neccessory deduction be done on the store table.
Step 1 is working fine. However, step 2 is not updating the store table records.
The code is as shown below;
if (@$_REQUEST['Submit2'] == "Process REQUISITION") {
$entryid = $_REQUEST['entryid'];
$requisitiondate = $_REQUEST['requisitiondate'];
$status = $_REQUEST['status'];
$department = $_REQUEST['department'];
$procurementaction = $_REQUEST['procurementaction'];
$procurementactionname = $_REQUEST['procurementactionname'];
$systemapprovallist = $_REQUEST['systemapprovallist'];
$secround = $_REQUEST['secround'];
if(isset($_REQUEST['product']))
{
$product = $_REQUEST['product'];
}
if(isset($_REQUEST['qtyfigs']))
{
$qtyfigs = $_REQUEST['qtyfigs'];
}
if(isset($_REQUEST['remarks']))
{
$remarks = $_REQUEST['remarks'];
}
$integer = 0;
require_once("../admin/db.php");
$sql_update="UPDATE `requisition` SET
requisitiondate='$requisitiondate',
status='PROCESSED',
department='$department',
procurementaction='PROCESSED',
procurementactionname='$fullname',
systemapprovallist='FINISHED',
secround='FINISHED'
WHERE entryid='$entryid'";
// this is where i want to place the store table record update.
$sql = "UPDATE stores SET qtyinstock = qtyinstock -
'".$qtyfigs[$integer]."'";
/* Passes query to database */
$result = mysql_query($sql_update);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p><p><a
href=\"" . $_SERVER['PHP_SELF'] . "?updaterecord=" .$entryid. "&Submit=Edit\">Click
here</a> to return to Problem Log page");
exit();
}
else{
echo"<b>Store Requisition PROCESSED.</b>";
}
}
I am lost as to how to update the store table records with the values of
requisitionitems table.
Your help is welcome.
Thanks.