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

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

 



On Tue, Jul 19, 2011 at 04:05, Dr Michael Daly <gp@xxxxxxxxxxxxxxxxx> 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/

-- 
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