Re: [PHP] Can't Connect Within Function?!

2003-09-01 Thread Dan Anderson
add this in the 1st line of the body of the function: global $shs_MySQLServer; global $shs_MySQLUser; global $shs_MySQLPassword; On Mon, 2003-09-01 at 14:20, Seth Willits wrote: > If I try to connect to a database within a function, I get the > following error. Why is this? > > > MySQL Connec

Re: [PHP] Can't Connect Within Function?!

2003-09-01 Thread Seth Willits
On Monday, September 1, 2003, at 11:33 AM, Mike Morton wrote: You need to read up on the scope of variables within functions. Ohh, I didn't even think of that. Thanks. Seth Willits --- President and Head Developer of Freak

Re: [PHP] Can't Connect Within Function?!

2003-09-01 Thread Mike Morton
You need to read up on the scope of variables within functions. You should have something like: function getUserPermissions($shs_MySQLServer,$shsMySQLUser,$shs_MySQLPassword) { if ($_SESSION['permissions'] == '') { // Connecting, selecting database $link = mysql_connect($shs_MySQLServer, $shs

Re: [PHP] Can't Connect Within Function?!

2003-09-01 Thread Curt Zirzow
* Thus wrote Seth Willits ([EMAIL PROTECTED]): > If I try to connect to a database within a function, I get the > following error. Why is this? > > > MySQL Connect Error : Can't connect to local MySQL server through > socket '/Private/tmp/mysql.sock' (2) > > function getUserPermissions() { >

[PHP] Can't Connect Within Function?!

2003-09-01 Thread Seth Willits
If I try to connect to a database within a function, I get the following error. Why is this? MySQL Connect Error : Can't connect to local MySQL server through socket '/Private/tmp/mysql.sock' (2) function getUserPermissions() { if ($_SESSION['permissions'] == '') { // Connecting, selecting