Connect to MsSQL Database using PHP
Connect to MsSQL Database using PHP, this is a simple article for connecting to MSSQL Database using PHP. Here we are using two functions one is mssql_connect and mssql_select_db functions. mssql_connect is used for connecting to database, and mssql_select_db is used for selecting db. Use this code for connecting to mssql database using php.
While connecting to Mssql database you need these credentials.
- Host Name
- Database User Name
- Database Password
While selecting database, you need to have database name.
<?php // Create a link to MSSQL $link = mssql_connect('hostname', 'dbuser', 'dbpass'); // Select the database 'php' mssql_select_db('dbname', $link); ?>
Just use this code for connecting to mssql database using php.
Crud using php and ms sql