我想通过ODBC从PHP连接到SQLServer 2005,但我不确定。
我已经在控制面板中创建了DNS。
请告诉我解决方法,为什么不能连接?
我已经从php连接到Sqlserver2008是ok的。
Code
odbc_connect("test2", "test2","12345") or die("Fail");
Connection fail
您可以使用mssql_connect()。
您可以在这里看到用户提供的评论http://www.php.net/manual/en/function.mssql-connect.php
看看这个url http://www.w3schools.com/php/php_db_odbc.asp这可能对你有帮助。
$cxn = odbc_connect("ODBC_DSN_NAME", "", "");
$sql = "SELECT * FROM some_table'";
$res = odbc_exec($cxn, $sql);