I have a class that connects to the db. I’m using global variables to pass the server, login, password, and database. This works in a function but not in a method. I can print_r and see the properties but still errors out when I try it in the class. Here an example of what works and not.
Doesn’t work:
public function connection(){
require_once(‘includes/DBconn.php’);
$this->_connection = mssql_connect($_GLOBAL[‘login’],$
if(!mssql_select_db($_GLOBAL[‘database’],$this->
die(“Could not select DB”);
}
}
works:
public function connection(){
$this->_connection = mssql_connect(‘server’,’login’,’password’);
if(!mssql_select_db(‘database’,$this->
die(“Could not select DB”);
}
}
I know it’s likely something stupid I’m doing. Let me know.
Thanks.