I have this query:
pg_prepare($conn, 'set_ui_advanced', 'update system.boxes set ui_advanced=$1 where id=$2');
$update_cmd_exec = pg_execute($conn, 'set_ui_advanced', array($ui_advanced, $system));
The column is boolean type.
Whenever I get my variable from the front-end like this:
$ui_advanced = boolval(trim($_POST['ui_advanced']));
I'm passing 0 and 1 and then return the variable and get false, true respectively. So, I've verified that my variables have gone through correctly. However, when passed to the query, my column only updates if the variable was set to 1 and not 0, even though I'm still getting true and false back.
I solved it by just using:
intval($variable)
instead and letting postgres deal with it, but why wouldn't true AND false work?
I looked HERE to verify that postgres allowed true and false which is how php represents true, false.