?
Solved

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
2
Medium Priority
?
2,266 Views
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.
<?php
	$username = 'a';
	$password = 'a';
	$server = 'SQLEXPRESS';
	$database = 'testdb';
	
	if (function_exists(mssql_connect)) {
		echo "Function Exists";
	}else{
		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);
		echo(mssql_num_rows($result));
	}
?>

Open in new window

0
Comment
Question by:Marius0188
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22996359
you need to enable the mssql extension. The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini.
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 22996391
http://www.php.net/manual/en/mssql.installation.php

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
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 …
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

839 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