help creating my connection object
Posted: Tue Apr 12, 2011 11:22 am
I am currently developing a drupal 6 website on a WAMP server. Windows 7, Apache 2.2.11, MySQL 5.1.36 and PHP 5.3.0. I need to be able to query some data from a Microsoft SQL Server 2008 database.
I currently have this script below, but I have been told that I need to create my own connect string because mssql_connect() is not supported by PHP 5.3.0.
KEEP ON GETTING THIS ERROR:
Fatal error: Call to undefined function mssql_connect()
I have been advised that I need to create my own connection object and connect to MSSQL. So I need to create my own 'mssql_connect' object. Is there anybody out there that can give me assistance on how I would go about doing this... ANY HELP WOULD BE APPRECIATED!!
Cheers!!
I currently have this script below, but I have been told that I need to create my own connect string because mssql_connect() is not supported by PHP 5.3.0.
Code: Select all
<?php
$myServer = "COMPNAME\SQLEXPRESS";
$myUser = "dbadmin";
$myPass = "dbadmin";
$myDB = "database123";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
if (!$dbhandle) {
die('Something went wrong while connecting to MSSQL');
}
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//close the connection
mssql_close($dbhandle);
?>Fatal error: Call to undefined function mssql_connect()
I have been advised that I need to create my own connection object and connect to MSSQL. So I need to create my own 'mssql_connect' object. Is there anybody out there that can give me assistance on how I would go about doing this... ANY HELP WOULD BE APPRECIATED!!
Cheers!!