পৃষ্ঠাসমূহ

মঙ্গলবার, ১৯ অক্টোবর, ২০১০

How to connect sql server 2000 using php

There are several database systems which we can use in php such as sql server 2000, mySQL, etc. Connection with mySQL is very common now a days. But sql server 2000 is quite older. Although many are using this. The code for the connection with sql server is very easy but we need to very careful about some steps. I will discuss about these is this article. First we can go for the source code which is given below.
$con = mssql_connect("server_name", "username", "password");
Here 'server_name' is localhost or if any name of your sql server has. 'username' and 'password' is the sql server username and server password respectively.

Now you need to do some other important thing to work without any error message. I used WAMP server for it. You also can use XAMPP. As I used WAMP so I am telling what to do for this case.
Al you write the code correctly you can face some errors like:
Undefined function:mssql_connect(); in bla bla....
So here is the solution. After installing WAMP you will see the icon of WAMP at right bottom corner of the window. Click it, you will see some options. Go to PHP tab and then you will find php.ini file. Open it, find php_mssql.dll and uncomment it(remove the semicolon from the left). Another thing, go to php extensions and find mssql. Then check it. Now restart the server and again start it. Now you can run the program writing necessary codes. Hope it will work smoothly. Go for it.