Hi There;
I have a problem during connection to a MS-SQL server. I copy the code there: http://www.webcheatsheet.com/PHP/connect_mssql_database.php
<?php
$myServer = "localhost";
$myUser = "Murat";
$myDB = "examples";
//Point 1
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser)
or die("Couldn't connect to SQL Server on $myServer");
//Point 2
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT id, name, year ";
$query .= "FROM cars ";
$query .= "WHERE name='BMW'";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["name"] . $row["year"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>
When I write echo "hello"; to point 1, it can be seen, however, when I write it to point 2, nothing has appeared in my browser.I presume that I face a connection problem but I couldn't overcome. I've installed necessary database driver named "SqlSrv" to c:\program files\php\ext from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20098 in compliance with there : http://www.php.net/manual/en/mssql.requirements.php
Any help is greatly appreciated. Here is my technical infrastructure:
PHP Version: PHP Version 5.3.8
Internet Server: IIS 5.1
OS: Windows XP Professional Service Pack 3