I have a form that takes an array of IDs and POSTS them when a button is clicked.
I have printed the array using print_r, and i can see that values are actually being passed
Array ( [staff_id] => Array ( [0] => 18 ) [Submit] => Inactivate )
In the above instance, I have clicked one check box so only one record ID is added to the array.
Then i have this function in a class that should update the database and change status of the record
function inactivate_staff($inputArray) {
if(isset($inputArray['Submit'])){
foreach($inputArray['staff_id'] as $row){
$this->staff_id = $row['staff_id'];
$sql = "UPDATE staff SET status='0' WHERE staff_id='$this->staff_id'";
$result[] = mysql_query($sql) or die(mysql_error());
}
return $result;
}
}
But when I check the database, no Update is done, yet similar parts work elsewhere in the application.
When i check the returned result using print_r, the array is as follows
Array ( [0] => 1 )
This means it acknowledges the mysql_query has run successfully. Why is it then that no update is done to the database?