RE: How to output a NULL field?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if(empty($rs->Fields(22))){
	$q4 = '';
}else{
	$q4 = ''.$rs->Fields(22);
}	   

Still produces errors, whether using "empty" or "is_null"....with single quotes....

???

-----Original Message-----
From: Bastien Koert [mailto:phpster@xxxxxxxxx] 
Sent: Tuesday, August 25, 2009 2:17 PM
To: David Stoltz
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  How to output a NULL field?

On Tue, Aug 25, 2009 at 2:00 PM, David Stoltz<Dstoltz@xxxxxxx> wrote:
> $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!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


$q4 =  '' . $rs->Fields(22);

Note that it's two single quotes
-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux