How to get WAMP to work with MSSQL
Download a clean version of WAMP: HERE
Next, download the newest add-on of php: HERE
Next, download ntwdblib.dll: "ntwdblib.DLL" Download 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 (:
Anichandran Tamilvalavan.
<?php
//mssql.secure_connection = On
// Need to upload ntwdblib.dll from net
$myServer = “localhost”; // host/instance_name
$myUser = “sa”; // username
$myPass = “sa″; // paasword
$myDB = “myfraiche”; // database name
// connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die(“Couldn’t connect to SQL Server on $myServer”);
// select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die(“Couldn’t open database $myDB”);
echo “You are connected to the ” . $myDB . ” database on the ” . $myServer . “.”;
$query = “SELECT top 10 * FROM tbl_customers”; // your database query
$result = mssql_query($query);
while($row = mssql_fetch_assoc($result))
{
print_r($row);
}
// close the connection
mssql_close($dbhandle);
?>
//mssql.secure_connection = On
// Need to upload ntwdblib.dll from net
$myServer = “localhost”; // host/instance_name
$myUser = “sa”; // username
$myPass = “sa″; // paasword
$myDB = “myfraiche”; // database name
// connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die(“Couldn’t connect to SQL Server on $myServer”);
// select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die(“Couldn’t open database $myDB”);
echo “You are connected to the ” . $myDB . ” database on the ” . $myServer . “.”;
$query = “SELECT top 10 * FROM tbl_customers”; // your database query
$result = mssql_query($query);
while($row = mssql_fetch_assoc($result))
{
print_r($row);
}
// close the connection
mssql_close($dbhandle);
?>
No comments:
Post a Comment