Page 1 of 1

Fatal error: Call to undefined function: mssql_connect() in

Posted: Fri Aug 04, 2006 6:46 am
by shiranwas
Hi,,

Fatal error: Call to undefined function: mssql_connect() in c:\apache\htdocs\complaints\Conn.php on line 5



when i trying to commect to MSSQL2000 I get aboue error message,
what is the error with my code,

Code: Select all

<?php

		$username = "sa";
		$password = "admin";
		$server= "SOFT_7";	
		$dbh =mssql_connect($server, $username, $password) 		
		or die("Unable to connect to mssql");		
		mssql_select_db('ecomplains',$dbh);
?>

thanx in advance
shiran

Posted: Fri Aug 04, 2006 6:53 am
by volka
Try this one

Code: Select all

<?php
echo 'mysql extension loaded: ', extension_loaded('mssql') ? 'yes':'no';
?>
if it says 'no' read http://de2.php.net/mssql esp. "Requirements" and "Installation"

Posted: Fri Aug 04, 2006 7:24 am
by shiranwas
hi,

i tried

Code: Select all

<?php 
echo 'mysql extension loaded: ', extension_loaded('mssql') ? 'yes':'no'; 
?>
echo 'mysql extension loaded: no

i do not understand what was there in the link u given to me

Installation
The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini.

To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib.



shiran

Posted: Fri Aug 04, 2006 7:54 am
by volka
I suppose you use php on some windows system.
Did you download a php package that has a php_mssql.dll in either the directory extension(php4) or in ext(php5)?
If so, run

Code: Select all

<?php phpinfo(); ?>
to find out which php.ini is used. In this file there is probably a line
;extension=php_mssql.dll
Remove the semicolon, save the file and restart the apache.
If you met Requirements for Win32 platforms the mssql extension schould now be available.

Posted: Fri Aug 04, 2006 8:20 am
by infolock
Also, are you sure you are installing Microsoft SQL Server (MSSQL)? Or are you installing MySQL ?? The 2 are completely different.

Second, what version of php are you using? Are you using 4.x or 5.x? If you are using 5.x, you should be using mysqli, not mysql.

Last, as the others have said, you may want to ensure you installed the libraries and extensions, and also that you setup the php.ini correctly.