why does this not work?
if($result = $db->execute($params) && $result->rowCount() > 0)
I get an error when the $db->execute fails that $result is a non-object.
of course it is. $result equals FALSE so it should skip the rowCount check shouldn't it?
if($result = $db->execute($params) && $result->rowCount() > 0)
is the same as
if($result = ($db->execute($params) && $result->rowCount() > 0))
You should do
if(($result = $db->execute($params)) && ($result->rowCount() > 0))
Or, even better:
$result = $db->execute($params);
if($result && $result->rowCount() > 0)