This is what I want to accomplish:
I have employee, printer, printerbox and scanbox table. What i want to do is when i delete an employee from employee table, it will look at employee's username in printer table then get the coresponding printbox and scanbox number of the employee, once i have the printebox and scanbox number of that employee, i will update printbox and scanbox table, then finally delete the employee from the printer table,
Please see that code below. Its not updating the printbox and scanbox table.
[codebox]//delete printer related records
$deldata = $deleted_values["username"];
$strSQLExists = "select from printer where username='$deldata'";
$rsExists = db_query($strSQLExists,$conn);
$datafordel=db_fetch_array($rsExists);
if($datafordel){
// updating printerbox table
$printboxdata = $datafordel["printbox"];
$strSQLExistsPB = "select from printbox where printbox='$printboxdata'";
$rsExistsPB = db_query($strSQLExistsPB,$conn);
$printboxdatafound = db_fetch_array($rsExistsPB);
$printboxdatafoundPB = $printboxdatafound["printbox"];
$strSQLUpdatePB = "update printbox set status='Available' where printbox='$printboxdatafoundPB'";
db_exec($strSQLUpdatePB,$conn);
// updating scannerbox table
$scanboxdata = $datafordel["scanbox"];
$strSQLExistsSB = "select * from scanbox where scanbox='$scanboxdata'";
$rsExistsSB = db_query($strSQLExistsSB,$conn);
$scanboxdatafound = db_fetch_array($rsExistsSB);
$scanboxdatafoundSB = $scanboxdatafound["scanbox"];
$strSQLUpdateSB = "update scanbox set status='Available' where scanbox='$scanboxdatafoundSB'";
db_exec($strSQLUpdatePB,$conn);
// delete user from printer
$printerdata = $deleted_values["username"];
$strSQLDeleteP = "delete from printer where username='$printerdata'";
db_exec($strSQLDeleteP,$conn);
}[/codebox]