PHP connection to MSSQL and errors during use_PHP tutorial

WBOY
Release: 2016-07-13 17:45:26
Original
836 people have browsed it

Environment PHP5.2.6
SQL2005 Standard Edition
SERVER2003 SP2


1: The SQL2005 file is damaged and cannot be used normally. Then, it is not completely uninstalled. Result: Reinstall the system, which is convenient and fast.
2: There are some minor problems with PHP configuration to support MSSQL. The mssql_connect connection method cannot be connected. You can only use ODBC to connect
Solution: Add NTWDBLIB.DLL to SYSTEM32. PHP comes with connection 7.0 and is invalid for 2005
It is said that this DLL can be found in the SQL installation file - -!

Attached are the codes for the two connection methods:
//mssql_connect connection method
//Server and login Info
$SERVER = 'IP';
$USER_NAME = "USER";
$USER_PASS = "PASS";
$DATABASE = "DBNAME";

//Connecting to the server
$CONN = mssql_connect($SERVER, $USER_NAME, $USER_PASS)or die ("Can't connect to Microsoft SQL Server");

//Selecting the database
$connection = mssql_select_db($DATABASE, $CONN)or die ("Can't connect to Database");
if($connection) printf ("Connected successfully");
?>
//ODBC connection method
$connection_string = 'DRIVER={SQL Server};SERVER=IP;DATABASE=DBNAME';
$user = 'USER';
$pass = 'PASS';
$connection = odbc_connect( $connection_string, $user, $pass ) OR die("??");
if($connection) printf ("Connected successfully");
?>
Author "Growth Footprints"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478658.htmlTechArticleEnvironment PHP5.2.6 SQL2005 Standard Edition SERVER2003 SP2 1: The SQL2005 file is damaged and cannot be used normally. Then, it is not completely uninstalled. Result: Reinstalling the system is quick and easy. 2: PHP configuration support...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!