sqlsrv_connect function cant connect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adamkini
    New Member
    • May 2010
    • 2

    sqlsrv_connect function cant connect

    hi
    i was writing a code to connect to sql server database..the username,passwo rd,and database name are all ok but it can't connect i have enable mixed mode authentication in sql server...it just says connection failed
    here is the code
    Code:
    function db_connect(){  
       	$servername ='mail';
    	$root ='fund_nouser';
    	$pass ='****';
    	$dbname='fundmaster';
    	$connectionInfo= array("UID"=>$root,
    						   "PWD"=>$pass,
    						   "Database"=>$dbname);	
    	$cx = cx();
    //connection string
       if ($cx == 0){
        $conn = sqlsrv_connect($servername,$connectionInfo);
       }
       	if (!$conn)
    	{
    		exit("Connection Failed: " . $conn); 
    		return 0;
    	}
    	else
    	{
    	 /
    	return $conn;
    	}
    }
    Last edited by Dormilich; May 12 '10, 09:26 AM. Reason: removed password
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Take a look at the sqlsrv_errors function to see if it can help you debug the problem.

    Comment

    Working...