Re: php 4 script with php 5.

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

 



Dwayne Hottinger wrote:

>I am trying to transfer some databases and php scripts that populate them to a
>new server.  Server is running Fedora core 4 with mysql 4.x and php 5.0.5.
>Original scripts were writen with php 4.x and worked fine.  I get a PHP Notice:
> Undefined variable: return_array when running them on the new server and the
>database doesnt get populated.  Mysql database and mysql user rights seem to be
>correct.  Do I have to rewrite the script for php 5.x or should it work and I
>need to dig for another problem?  Im quite new to php and dont know quite which
>way to go for help. I hope I have posted this on the right list.
>
>ddh
>

Hello Dwayne,

This is easy enough, all you need to do is define return_array. I've
included an example here, it's mailer code, but, should illustrate what
you need to do.

function test()
{
$return_array = null;
if (...) {
    $return_array = $db->getAll("SELECT * FROM table", DB_FETCHMODE_ASSOC);
}
return $return_array;
}

That means, you need to assign or indicate that return_array exists
before you use it in something like return or other PHP function. Your
php.ini file for PHP 4 could have been more forgiving coming to these
notices/warnings.

Warm Regards,
Torgny Bjers

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