You are here: Re: [PHP] php 4 script with php 5. « PHP « IT news, forums, messages
Re: [PHP] php 4 script with php 5.

Posted by Torgny Bjers on 10/05/79 11:27

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация