Hi guys i hm havig problem....My Code is

<?php


$conn = mssql_connect("FARHAD-PC\SQLEXPRESS","","");


mssql_select_db("Testing",$conn);




$query = "select * from User1";

echo $query;




?>

The error iss

Fatal error: Call to undefined function mssql_connect() in C:\wamp\www\Testing\SqlConnection.php on line 4

Hope someone will help me..
Regards..
Farhad

You should probably start by checking php.ini and ensure that everything is turned on for msssql that needs to be.

Yes it appears the mssql module has not been installed. If you are using xampp then it is as simple as removing the ; from the beginning of the line with ;mssql.dll . If however you are using the script on a linux server then you will need to recompile php and apache to embed the package. If using whm/cpanel this is simple thanks to a shell script but if you don't have whm/cpanel then it can be a hard task. Note that if your using a shared service then all you need to do is contact your webhost.

You should probably start by checking php.ini and ensure that everything is turned on for msssql that needs to be.

how can i check by php.ini?

Yes it appears the mssql module has not been installed. If you are using xampp then it is as simple as removing the ; from the beginning of the line with ;mssql.dll . If however you are using the script on a linux server then you will need to recompile php and apache to embed the package. If using whm/cpanel this is simple thanks to a shell script but if you don't have whm/cpanel then it can be a hard task. Note that if your using a shared service then all you need to do is contact your webhost.

i m using Wamp server....
how can i use mssql.dll?

Here is a link to get mssql to work with wamp.

It quotes the below:

Download a clean version of WAMP: HERE
Next, download the newest add-on of php: HERE
Next, download ntwdblib.dll: HERE


1)* Install WAMP
2) Install latest php addon.
Dont do anything with ntwdblib.dll YET!
3) Click on the WAMP icon -> PHP -> Version and select 5.3.1.
4) Click on the WAMP icon -> PHP -> PHP Extensions then check php_mssql and php_pdo_mssql.
(Wamp will restart and give you few errors, ignore them)
5) Restart WAMP one more time to ensure settings are saved.
6) Finally, place ntwdblib file in the two following directories:
wamp\bin\php\php5.3.1
wamp\bin\apache\apache2.2.11\bin
7) Restart wampserver, and you're finished!

---------------
*1) SKIP THIS STEP IF YOU ALREADY GOT WAMP INSTALLED

Your finished, and hopefully now php will be happy to talk to mssql (:


Since the original author deleted the guide, I decided to bring it back (:
Based on original but cleaned-up guide by Alexsh.

Cheers.

Here is a link to get mssql to work with wamp.

It quotes the below:

i have done all the thing but again there is problem.... :( :(
error is
all to undefined function mssql_connect() in C:\wamp\www\Testing\SqlConnection.php on line 4

damn!

Well other than the link provided I'm not sure how to do it in wamp unless you were to switch to xampp in which case you can uncomment the mssql line in the appropriate php.ini file.

Guyz thank You very much for trying to solve my problem...
but i spent too much time to solve this problem but unforunately i m not able to do it.......
now finally i will deloy my sql database to mysql then i will use it...
Thanks again for giving me time....
Regards..
Farhad

Guyz thank You very much for trying to solve my problem...
but i spent too much time to solve this problem but unforunately i m not able to do it.......
now finally i will deloy my sql database to mysql then i will use it...
Thanks again for giving me time....
Regards..
Farhad

Just an advice:
If you use mysql_** you will have to rewrite all lines with new db eg pg_** and migration is hard. If you use PDO, you will only have to change one string and the whole code stays intact. So I will say go for PDO.
BTW don't forget closing the thread! Mark it solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.