PHP 5.2.6 MS SQL Connection Error: Call to undefined function mssql_connect() in E:\wamp\www\JitWeb\new_item.php

Posted on 2008-11-19
Last Modified: 2013-12-13
Dear Experts,

I am trying to connect to a MS SQL Server database.
I receive the following error:
Call to undefined function mssql_connect() in E:\wamp\www\JitWeb\new_item.php

The test to see if "mssql_connect" function exists returns negative.

Please see code below.

	$username = 'a';

	$password = 'a';

	$server = 'SQLEXPRESS';

	$database = 'testdb';


	if (function_exists(mssql_connect)) {

		echo "Function Exists";


		echo "Function Missing!!!!";



	if (isset($_GET['submit'])) {

		$dbhandle = mssql_connect($server, $username, $password) or die('Unable to connect!');

		$db = mssql_select_db($database, $dbhandle) or die('Unable to select database!');

		$query = 'SELECT * FROM tblItemMastere';

		$result = msql_query($query);




Open in new window

Question by:Marius0188
    LVL 82

    Accepted Solution

    you need to enable the mssql extension. The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini.
    LVL 50

    Expert Comment

    by:Steve Bink

    Does your phpinfo() show that MSSQL is compiled with your PHP installation?  Is the php_mssql.dll installed in php.ini?

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now