Would anyone be able to tell me where I could put an IF statement into the following code, to prevent it from running when $Status is not equal to "Working"?
I guess the main problem here is that Status is set to "Attention" in the sql2 query - so I need to be able to test the content of $Status prior to the SQL queries.
Thanks for any pointers,
Steven
Code:
if (isset($_POST['FaultType'])):
// The author's details have been updated.
$id = $_POST['id'];
$sql = "INSERT INTO Faults SET ComputerID='$ComputerID', FaultStatus='Attention', FaultType='$FaultType', FaultDescription='$FaultDescription', StaffID='$StaffID', TechID='Unknown'"; // Add details of fault to table Faults
$sql2 = "UPDATE Workstation SET Status='Attention' WHERE ComputerID='$id'"; // Change Computer Status to Attention
if (@mysql_query($sql) AND @mysql_query($sql2)) {
echo '<p>Fault logged - thank you. </p>';
} else {
echo '<p>Error logging fault. Fault not logged successfully. ' .
mysql_error() . '</p>';
}
I guess the main problem here is that Status is set to "Attention" in the sql2 query - so I need to be able to test the content of $Status prior to the SQL queries.
Thanks for any pointers,
Steven