| jaquito13 2004-05-22, 6:30 am |
| I am working on a script that connects to MySQL databases using a
function. To initiate the function in the example below, I would type
the code --------
dbconnect('main').
--------I then want it to parse the user, host, and password into the
function from preset variables. I think that you get the picture.
Thanks for any help.
--------
main = "my_database";
main_user = "my_username";
main_pass = "my_password";
main_host = "localhost";
function dbconnect(database) {
db = ''.database;
user = db.'_user';
pass = db.'_pass';
host = db.'_host';
dbconnect = mysql_pconnect(eval(" host =
"host ";"),
eval(" user =
"user ";"),
eval(" pass =
"pass ";")) or die();
mysql_select_db
(eval(" db =
"db ";")) or die();
}
--------
----------------------------------------
The post originated from PHP
Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
|