Re: How to replace define in a require file with mysql?

From: Date: Wed, 17 Oct 2007 15:31:34 +0000
Subject: Re: How to replace define in a require file with mysql?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263269@lists.php.net to get a copy of this message
Ronald Wiplinger wrote:
I have a file linked with require into my program with statements like: define("_ADDRESS","Address"); define("_CITY","City"); I would like to replace this with a mysql table with these two fields (out of many other fields). How can I do that? bye Ronald Well, if you have all the settings in a DB already, then what I would do is this.
SELECT param_name, param_value FROM yourTable; then while ( list($name, $value) = mysql_fetch_row($results_handler) ) { define($name, $value); } put this in place of your existing defines and you should be good. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#263269) next »