Knowledgebase: MSSQL
Connect to MSSQL via PHP
Posted by - NA - on 24 February 2010 01:20 AM
|
|
<?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 ?> | |
|
Comments (2)
Tawfiq
10 August 2011 04:53 AM
I tried running this code with my variables and get this error:
Fatal error: Class 'COM' not found
How does one set up PHP support for MSSQL on an arvixe server via cpanel?
Fatal error: Class 'COM' not found
How does one set up PHP support for MSSQL on an arvixe server via cpanel?
Ryan C
19 October 2011 07:48 AM
MSSQL support is only available on our Windows ASP hosting at this time.