Here i put the code php to sql server.this is connection string between php and sqlserver.
<?php
$myServer = "localhost";
$myUser = "your_name";
$myPass = "your_password";
$myDB = "examples";
//connection to the database
$dbha = 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, $dbh)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT id, address, city ";
$query .= "FROM city ";
$query .= "WHERE id='001'";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h2>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["address"] . $row["city"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>
