Start a conversation

Connect to MS SQL via PHP

<?php

//Code for connection on Arvixe

$myServer = "localhost\SQLEXPRESS";

$myUser = "Database User Name"; // replace with your values

$myPass = "Database Password"; // replace with your values

$myDB = "Database Name"; // replace with your values


//create an instance of the  ADO connection object

$conn = new COM ("ADODB.Connection")

  or die("Cannot start ADO");


//define connection string, specify database driver

 $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;

  $conn->open($connStr); //Open the connection to the database

?> 

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Support-Agent

  2. Posted
  3. Updated

Comments

  1. amgadhavi

    good
  2. Abu Mozaffor Ali Ashfaque (BiploB)

    Please make it simple while saying this topic, i hasn't understood what r u trying to say regarding connect to MS SQL via PHP.