Hi guys,
I have a problem. been looking at forums all day but cant find the right one to help me out.
I'm using Windows 7 and EW(Expression Web) 4 to create a php site, but have had trouble all day trying to get it to connect to a MSSQL database (SQL Server 2008 R2).
I'm a complete noob with php so please bare with me
Here is my code to connect to the database
<?
$myServer = ".\MSSQLHOSTING";
$myUser = "Username";
$myPass = "Password";
$myDB = "database";
//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");
//declare the SQL statement that will query the database
$query = "SELECT UserName, UserPassword";
$query .= "FROM Administrator";
$query .= "WHERE UserName='Administrator'";
//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["UserName"] . $row["UserPassword"]. "</li>";
}
//close the connection
mssql_close($dbhandle);
?>
I get this error from this code: Fatal error: Call to undefined function mssql_connect()
What files and code do i need for this to work? Any help is welcome but remember i'm new to php
Thanks