You are here: Re: [PHP] What are these weird variables?? « PHP « IT news, forums, messages
Re: [PHP] What are these weird variables??

Posted by John Nichel on 06/03/05 18:24

Brian Dunning wrote:
> I'm using a class that I downloaded, and to access the database it uses
> variable names in all caps, like this:
>
> if(!defined("MAGPIE_DBUSER")) define("MAGPIE_DBUSER", "brian");
> ...
> $dbuser = MAGPIE_DBUSER;
> ...
> $dbh = mysql_connect($dbhost,$dbuser,$dbpass);
>
> And it works fine. But I already have my database parameters configured
> in some existing variables, so I tried to simplify all of the above and
> access it like this (these variables are my existing ones):
>
> $dbh = mysql_connect($db_host,$db_user,$db_pass);
>
> And it no longer works, says it can't connect to the database. What's
> the deal with those variables in all caps, and why won't mine work? The
> above class is inside a defined function, are my variables not valid
> inside that function?

http://us4.php.net/constants

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

 

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

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