Jump to content


Null fields


1 reply to this topic

#1 Lang

    Young Padawan

  • Members
  • Pip
  • 198 posts
  • Gender:Male
  • Location:Ontario, Canada

Posted 18 September 2005 - 01:01 AM

If I set a field to NULL what does it return in a query? Or is the variable left unset. So this would work:

if (isset($nullvar)){
   echo 'set';
}else{
   echo 'unset';
}


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 18 September 2005 - 05:23 PM

From what i know, it will count the variable as set.
Try
if($var === NULL){
    echo '$var is null';
}
//or
if(empty($var)){
    echo '$var is null/empty';
}






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users