CodeIgniter Forums
MSSQL Connection - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: MSSQL Connection (/showthread.php?tid=35552)



MSSQL Connection - El Forum - 11-02-2010

[eluser]shankar ganesh[/eluser]
I have to connect MSSQL using php5, but it says errors as below. I tried restarting my IIS, User and password is exists and its correct. But i don't know how to connect it.


Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ANGLER66 in /home/jumpwebservice/public_html/test.php on line 8


MSSQL Connection - El Forum - 11-02-2010

[eluser]tonanbarbarian[/eluser]
what are the connection details you are using?
is it possible that the hostname you are using for the server is not resolving correctly?


MSSQL Connection - El Forum - 11-03-2010

[eluser]shankar ganesh[/eluser]
These are code i used for connection

Code:
<?php
$myServer = "ANGLER43\SQLEXPRESS";
$myUser = "sa";
$myPass = "";
$myDB = "cms";

//connection to the database
if($link = mssql_connect($myServer, $myUser, $myPass))
{
    if(mssql_select_db($myDB, $link))
    {
        echo "Database found";
    }
    else
    {
        echo "Database not selected";
    }
}
else
{
    echo 'Not Connected';
}

?>



MSSQL Connection - El Forum - 12-15-2010

[eluser]cool248[/eluser]
try changing the myserver to the local ip address number (127.0.0.1) or with current ip address in your pc.