How to output a NULL field?
| From: | David Stoltz | Date: | Tue, 25 Aug 2009 18:00:04 +0000 |
| Subject: | How to output a NULL field? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297205@lists.php.net to get a copy of this message | ||
$rs->Fields(22) equals a NULL in the database
My Code:
if(empty($rs->Fields(22))){
$q4 = "";
}else{
$q4 = $rs->Fields(22);
}
Produces this error:
Fatal error: Can't use method return value in write context in
D:\Inetpub\wwwroot\evaluations\lookup2.php on line 32
Line 32 is the "if" line...
If I switch the code to (using is_null):
if(is_null($rs->Fields(22))){
$q4 = "";
}else{
$q4 = $rs->Fields(22);
}
It produces this error:
Catchable fatal error: Object of class variant could not be converted to
string in D:\Inetpub\wwwroot\evaluations\lookup2.php on line 196
Line 196 is: <?php echo $q4;?>
What am I doing wrong?
Thanks!