Upload Share and Earn

Monday, August 20, 2007

PHP MSSQL connecting script and function

WE can connect to MSSQL database by using PHP. To connect to MsSQL we have to enable the MsSQL extension support inside php.ini file. For this we have to uncomment the line saying
extension=php_mssql.dll The status of the MSSQL support can be checked by using phpinfo function.
To check the PHP support for MSSQL we can use the function phpinfo(). To enable MSSQL support we have to uncomment the this line inside php.ini file. extension=php_mssql.dll If the support exists then you will get the details like this below.



Once the support is available we can use different functions to handle data from MSSQL database. Now let us try for connecting to MSSQL database server. Here are the connection steps. Note that we have used one remote db server but same string will work for a local server also.
$dbusername='username';
$dbpassword='password';
$servername='servername';
$link = mssql_connect ($servername,$dbusername,$dbpassword);

No comments:

 
eXTReMe Tracker