You are here: Re: A small problem in running PHP4 under PHP5 - $row[fieldname] « PHP Programming Language « IT news, forums, messages
Re: A small problem in running PHP4 under PHP5 - $row[fieldname]

Posted by Richard on 06/29/07 17:45

"xhe" <hexufeng@gmail.com> wrote in message
news:1183136663.887183.233560@q75g2000hsh.googlegroups.com...
>I have just upgraded my php version form php4 to php5. and I met this
> problem, and don't know if you know the solution.
> My site was written in PHP4, and most parts can be running smoothly in
> PHP5, only that in old version, I can use $row[fieldname] to access
> the data in database directly, no need to put double quote around
> fieldname. BUT in PHP5, this is wrong, I got error message "undefined
> constant". I know this is because PHP5 see the fieldname without
> double quote as constant instead of name of field. I know the slowest
> solution is to add double quotes one by one, but this will take a lot
> time.
> So are there any solution to change configuration in php.ini and let
> PHP5 accept this kind of usage just like that in PHP4?
> Thanks.

Hi xhe,

I would not recommend changing the settings.
Why not fix the problem now? You will only run into it again later.

Find a regular expression that replaces the [ ] with [" "]
or do search and replace in a decent text editor.
Its not that hard to do.

Richard.

 

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

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