Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello there.!
I've been doing a project in PHP(xampp) which requires to connect in MSSQL database.
I've already done things like downloading and installing SQLSRV30.exe in "C:\xampp\php\ext" folder and creating a simple program which determine whether the program is already connected or not but still couldn't figure it out the problem that i encountered.

PHP
$server = "IDEA-PC\SQLEXPRESS";
	$dbGet = array("Database"=>"LogboxDB");
	$con = sqlsrv_connect($server, $dbGet) or die (sqlsrv_error());
	if(!$con)
	{
		 die(print_r(sqlsrv_errors(), true));
	}
	else
	{
		echo 'Connected';
	}



Here is my error.
Fatal error: Call to undefined function sqlsrv_connect();
Please help me to get rid of this problem.
Thanks. GodBless :D
Posted
Comments
Christian Graus 11-Nov-13 0:41am    
The error means what it says. If this is a real method, it's included in something that this code cannot see, so if there's a library that provides this function, you don't have it configured properly, or don't have it installed properly. I've never used PHP, so I don't know the syntax, but I bet you have to tell it to load something to 'see' this library.

1 solution

You need to go to Microsoft and download the php drivers for SQL Server - php usually include native drivers fro MySQL database.
These are installed on your server (by copying files to appropriate directory) and then enabling them through your php.ini (or interface if available).

You may need to experiment a bit to find out which one of the drivers in the package is the correct one for you.


 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900