Re: ? simple solution for error resulting from upgrade to php5

From: Date: Tue, 19 Jul 2011 14:21:50 +0000
Subject: Re: ? simple solution for error resulting from upgrade to php5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-314117@lists.php.net to get a copy of this message
On Tue, Jul 19, 2011 at 04:05, Dr Michael Daly <gp@holisticgp.com.au> wrote: > Hi > is there a simple solution here, other than reverting to php4? > An upgrade from php5 to php5 has resulted in an error msg in this line: > > if(  strlen($db_res ) > 0 ) { Change that to: if (is_object($db_res)) { > I understand this is bec. php5 is object orientated. It says an > Object of class DB_result could not be converted to a string Right. Before, it was succeeding on strlen($db_res) > 0 because - like an array - when called as a string, it was evaluating to its variable type. For example: <?php $a = array('soo' => 'per', 'doo' => 'per'); echo $a; // Prints: Array $b = new fakeClass(); // Presuming this class exists echo $b; // Used to print: Object id #1 ?> -- </Daniel P. Brown> Network Infrastructure Manager http://www.php.net/

« previous php.general (#314117) next »