Hi
I wondered what the return value of the getOne method in the PEAR DB class
is when no row is found:
$what = $db->getOne("SELECT field FROM table WHERE 1=2");
if($what=="") echo "emptystring";
if($what==false) echo "false";
if($what==NULL) echo "null";
echo $what;
echoes "emptystringfalsenull". Is it possible that the function returns a
value that is an empty string, false and null at the same time?
If I want to check for the existence of a row, is it okay to check for
either of the three possibilities, or is there a preferred one?
$id = $db->getOne("SELECT id FROM table WHERE condition='fulfilled');
// this one?
if($id=="") do_something();
// or this one?
if($id==false) do_something();
// or that one?
if($id != NULL) do_something();
else do_something_else($id);
Thanks for every hint.
--
Markus