Hi All,

I am having a hard time connecting to a mssql db from within a class.  I
keep getting this error;
Warning: mssql_connect() [function.mssql-connect]: message: Login failed
for user 'SERVER\IUSR_SERVER'. (severity 14) in
G:\wwwdev\includes\dbclass.inc.php on line 20

$this->dbh              =       mssql_connect($this->dbhost,
$this->user, $this->pass);  //Line 20

Which indicates that he's not receiving the connection values.

In the declarations of the class I have;
protected $user;
protected $pass;
protected $dbhost;
protected $dbname;
protected $dbh;
protected $config_file  =       'config.inc.php';

And in the __constructor I am calling the config file.
include_once($this->config_file);
$this->user             =       $user;
$this->pass             =       $pass;
$this->dbhost   =       $dbhost;
$this->dbname   =       $dbname;

If I change it to pass values into the constructor and remove the call
to the config file from the class and put it in the file that
instantiates the class I get the same error.

If I assign the values to the vars on declaration then it works.  It is
my understanding that if a var is protected then it is used only in that
class and subclasses but not by class users.  This explains why when I
try to pass the values to the constructor it threw that error.  But why
can't I assign the values to the vars from inside the constructor by
including the config file?  Oddly enough when I debug the file I don't
get anything that indicates that it won't parse the class.

 

alex hogan
*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is addressed. The 
views stated herein do not necessarily represent the view of the company. If you are 
not the intended recipient of this e-mail you may not copy, forward, disclose, or 
otherwise use it or any part of it in any form whatsoever. If you have received this 
e-mail in error please e-mail the sender. 
*************************************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to