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.

Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe