As per the documentation here: http://rtfm.modx.com/display/xPDO20/xPDO.query
Which shows the following as an example:
$result = $modx->query("SELECT * FROM modx_users WHERE id=1");
if (!is_object($result)) {
return 'No result!';
}
I would assume this statement would work:
$checkUnique = $modx->query("SELECT * FROM my_table_name WHERE guid = '$unique' AND used = 0");
//guid already used, or non-existant
if(!is_object($checkUnique)){
$result = array(
"result" => false
);
return json_encode($result);
}
When I do a var_dump
(of $checkUnique
), I get this as a result:
object(PDOStatement)#22 (1) { ["queryString"]=> string(70) "SELECT * FROM my_table_name WHERE guid='5114722f24870' AND used=0"}
I know the used
column has been set to 1
, but it never triggers my if
block.
What am I doing wrong?