web 2.0

How to use PHP & SQL Server (mssql) Connect to Database

How to use PHP & SQL Server (mssql) Connect to Database Learn / tutorial php programming how to using  PHP and SQL Server database

ShotDev Focus:
- PHP & Connect to SQL Server

Solution

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost ‘/php_sqlserver.php’
..

PHP Warning: Unknown(): Unable to load dynamic library ‘./php_mssql.dll’ - The specified module could not be found. in Unknown on line 0

Solve Problem

Step 1
Open php.ini -> Start -> Run -> php.ini
copy php_mssql.dll to extension path ………. download file php_mssql.dll

extension_dir = “C:/AppServ\php5\ext”
.
.
.
.
.
extension=php_mssql.dll (Remove
; on file php.ini)

Step 2
Copy ntwdblib.dll to C:\Windows\System32\  ………. download file ntwdblib.dll

Restart Web Server

Example

php_sqlserver.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mssql_connect("localhost","sa","");
if($objConnect)
{
echo "Database Connected.";
}
else
{
echo "Database Connect Failed.";
}

mssql_close($objConnect);
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_sqlserver.php

Screenshot

PHP & SQL Server (mssql) Connect to Database

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

One Response to “How to use PHP & SQL Server (mssql) Connect to Database”

  1. 2dominican…

Leave a Reply

You must be logged in to post a comment.