How to make a connection with a sqlServer database by using PHP?

To make a connection with a mySql database :

  1. Use wamp server, to download it click here. Install it.
  2. Start it, left click on the icon in the task bar ( I say left click ;) )  
  3. PHP > PHP Extensions > select php_mssql
  4. In your php page or classe use this code :// sqlServer connection
    $login_sqlServer=USER; // your connection user
    $pwd_sqlServer=PWD’; // password connection user
    $chaine_connexion_sqlServer = IP_SERVER; // Name or IP of the databasse server
    $bd_sqlServer=DB_NAME; // Database name
    $con_sqlServer = mssql_connect($chaine_connexion_sqlServer, $login_sqlServer, $pwd_sqlServer) or die(“Impossible to make connection with  SQL Server “);
    $selected = mssql_select_db($bd_sqlServer, $con_sqlServer) or die(“Impossible to make connection with  SQL Server “);
  5. Congratulation… You made a connection with your sqlServer database by using php.


See also :




Share it with your freinds on Facebook Tweet it to your freinds on Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP SlimStat