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("SELE CT field FROM table WHERE 1=2");
if($what=="") echo "emptystrin g";
if($what==false ) echo "false";
if($what==NULL) echo "null";
echo $what;
echoes "emptystringfal senull". 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("SELE CT id FROM table WHERE condition='fulf illed');
// 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_el se($id);
Thanks for every hint.
--
Markus
I wondered what the return value of the getOne method in the PEAR DB class
is when no row is found:
$what = $db->getOne("SELE CT field FROM table WHERE 1=2");
if($what=="") echo "emptystrin g";
if($what==false ) echo "false";
if($what==NULL) echo "null";
echo $what;
echoes "emptystringfal senull". 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("SELE CT id FROM table WHERE condition='fulf illed');
// 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_el se($id);
Thanks for every hint.
--
Markus
Comment