Question

Locked

i need help please

By m.akkad ·
I'm writing the following piece of code to get some information from an SQL Server database....
<?php
$myServer = "server_name";
$myUser = "user_name";
$myPass = "password";
$myDB = "dbname";

//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 * ";
$query .= "FROM table ";
$query .= "WHERE some_conditions";

//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>";

//close the connection
mssql_close($dbhandle);
?>

but when i try to preform this page i get the following error...

Fatal error: Call to undefined function mssql_connect() in C:\AppServ\www\conn.php on line 8


can anyone suggest a solution for this error....

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

try

by Jaqui In reply to i need help please

changing the connection call to have the semi-colon at the end of the line.
$dbhandle = mssql_connect($myServer, $myUser, $myPass);

Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums