Home > Article > Backend Development > How to connect and configure php with mssql database_PHP tutorial
php tutorial how to connect and configure with mssql database tutorial
The extension php_mssql.dll that comes with PHP connects to SQL Server 2000 and uses the mssql series of functions to operate, the same as operating MySQL.
1. Open the PHP configuration file php.ini, find; extension=php_mssql.dll and remove the semicolon in front.
2. Find mssql.secure_connection = Off and change it to mssql.secure_connection = On.
3. Copy the two files php_mssql.dll and ntwdblib.DLL in the PHP folder to the C:windowssystem32 folder.
4. Restart Apache, OK
*/
//Use mssql_connect
$conn=mssql_connect('localhost','pandao','1987') or die('bKjia.c0m database cannot be connected');
mssql_select_db('test',$conn);
//query statement
$Query="select * from news";
$AdminResult=mssql_query($Query);
//Output results
$Num=mssql_num_rows($AdminResult);
for($i=0;$i<$Num;$i++)
{
$Row=mssql_fetch_array($AdminResult);
echo($Row[1]);
echo("
");
}