Hi all,
I have two tables namely users and generalclaims. Two users have been assign the role of approving claims issued by normal users.
This is my logic flow;
After a normal user submits claims to be vetted, the first approving officer picks the claims us and either APPROVES or REJECTS it. After which the second approving officer also picks the claims up and either APPROVES or REJECTS it.
This is what is managed to produce;
// When Approve is click
if (@$_REQUEST['Submit'] == "Approve") {
$entryid = $_REQUEST['entryid'];
$paidto = $_REQUEST['paidto'];
$modeofpayment = $_REQUEST['modeofpayment'];
$totalamount = $_REQUEST['totalamount'];
$status = $_REQUEST['status'];
$firstapprover = $_REQUEST['firstapprover'];
$secondapprover = $_REQUEST[' secondapprover '];
$sql_update="UPDATE generalclaims SET
paidto='$paidto',
modeofpayment='$modeofpayment',
totalamount='$totalamount',
status='$status',
firstapprover='APPROVED',
secondapprover='APPROVED'
WHERE entryid='$entryid'";
/* 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("Record updated successfully.");
}
}
// When Reject is clicked
if (@$_REQUEST['Submit2'] == "Reject") {
$entryid = $_REQUEST['entryid'];
$paidto = $_REQUEST['paidto'];
$modeofpayment = $_REQUEST['modeofpayment'];
$totalamount = $_REQUEST['totalamount'];
$status = $_REQUEST['status'];
$firstapprover = $_REQUEST['firstapprover'];
$secondapprover = $_REQUEST['secondapprover'];
$sql_update="UPDATE generalclaims SET
paidto='$paidto',
modeofpayment='$modeofpayment',
totalamount='$totalamount',
status='$status',
firstapprover='REJECTED',
secondapprover='REJECTED'
WHERE entryid='$entryid'";
/* 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("Record updated successfully.");
}
}
My problem is that when the second approving officer logs into the system and either APPROVES or REJECT a claims that the first approving officer has worked on, the firstapprover and secondapprover fields always become the same.
Please what am I doing wrong.
Need your help.
Regards