I am trying to update a record from a php script if the checkbox pendinginput_c is selected. I cannot get the record to update from the script. However if I type the exact command below in the mysql console then the record updates correctly.
if($bean->pendinginput_c == 'on')
{
$sql = "UPDATE cases SET status='Pending Input' WHERE id='958ca4e5-51'";
}
Further up in the script you will see there are other sql statements that are currently working. No updates, just selects.
$sql_nmb = "SELECT case_number FROM cases where id='".$bean->parent_id."'";
$result = $bean->db->query($sql_nmb, true);
$case = $bean->db->fetchByAssoc($result);
$sql = 'SELECT c.assigned_user_id , c.id , cc.contact_id as contact_id, co.first_name , co.last_name , ear.email_address_id ,ea.email_address FROM cases as c
LEFT JOIN contacts_cases as cc on c.id = cc.case_id
LEFT JOIN contacts as co on co.id = contact_id
LEFT JOIN email_addr_bean_rel ear ON ear.bean_id = contact_id
LEFT JOIN email_addresses as ea on ea.id = ear.email_address_id
WHERE c.id = "'.$bean->parent_id.'" and cc.deleted = 0 and ear.deleted = 0 and ea.deleted = 0';
$resp = $bean->db->query($sql, true);
Try this:
Additionally check that $bean->pendinginput_c really equals “on”. echo it above the if statement to double check.
Good luck!