php connection to mssql database and configuration method Now let me tell you how to connect php to mssql database and configure php mssql, so if you are a beginner, this article can give you a tutorial from configuring mssql to letting php connect to mssql database.
php tutorial connecting mssql database tutorial and configuration method
Now let me tell you how to connect php to mssql database and configure php mssql, so if you are a beginner, this article can give you a tutorial from configuring mssql to letting php connect to mssql database.
*/
//Link database
$localhost ='127.0.0.1';//mssql database ip
$sa ='sa';//mssql login username
$pwd='123';//Connection password
$db = 'cs';//Database
$conn=mssql_connect($localhost,$sa,$pwd) or die('mssql database connection failed');
mssql_select_db($db,$conn);//The database for the selection operation is the same as the mysql tutorial
//query statement
$query="select * from vc";
$adminresult=mssql_query($query) or die('sql'.$query);
//Output results
while( $rs = mssql_fetch_array( $adminresult ) )
{
echo $rs['0'];
}
/*
Things to note
1. Open php.in and remove the comment symbol of extension=php_mssql.dll.
2. Open php.in and change mssql.secure_connection = off to on.
3. Copy php_mssql.dll to the directory specified by extension_dir in php.in or the system system32 directory. (php_mssql.dll is included in the php compressed installation package).
After completing the above steps, you need to restart apache.
Note: In actual use, it was found that if you manually install php to iis through a php compressed file, you must restart the machine and not just iis.
4. You need to ensure that there is ntwdblib.dll under php or system32. Check the properties to ensure that its version is 8.00.194 and not 7.0