Hi guys!
Rather than fool around in PHP, I’m attempting to do some conditional work in a query:
UPDATE
venues_clients
SET
venues_clients.commission =
CASE
WHEN
venues_clients.commission <> ".$this->db->escape($array_parameters['commission'])."
THEN
".$this->db->escape($array_parameters['commission'])."
END,
venues_clients.mode =
CASE
WHEN
venues_clients.mode <> ".$this->db->escape($array_parameters['mode'])."
THEN
".$this->db->escape($array_parameters['mode'])."
END
WHERE
(venues_clients.client_id = " . $this->db->escape($array_parameters['client_id']) . ")
AND
(venues_clients.venue_id = " . $this->db->escape($array_parameters['venue_id']) . ")
If I make a change to both commission (a text field on the web and float on the database) and mode (a select on the web and an enum on the database), everything works. But if I make no changes, the commission continues to work, while mode column becomes empty.
Yes, the values are passing through the function with no problems.
Any ideas where I’ve gone wrong?