note 10354 added to Microsoft SQL Server functions
| From: | mohammedkaiser at collegeclub dot com | Date: | Fri, 29 Dec 2000 16:35:17 +0000 |
| Subject: | note 10354 added to Microsoft SQL Server functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9183@lists.php.net to get a copy of this message | ||
Hi!
I am new to Php and I am still learning.
I was trying to use php to connect to MS SQL Server and the sql server is running of windows NT.
when I tried it gave me this error
" Fatal error: Call to unsupported or undefined function mssql_connect() in
/u02/teamnet/html/departments/east_rutherford_it/Ms_Sql_Server/index.phtml on line 11 "
Could you please tell me whts wrong and wht I can do about it. I have also attached the code for
your reference.
Your help greatly appeciated
Thank you
Kaiser
CODE :
<?
// create connection
$connection = mssql_connect("$servername","$username","$password")
or die("Couldn't make connection.");
// select databasei
$dbname="TARDIS";
$db = mssql_select_db($dbname, $connection)
or die("Couldn't select database.");
// create SQL statement
$sql = "SELECT TESTID,TestName
FROM dbo_tblTEST ";
// execute SQL query and get result
$sql_result = mssql_query($sql,$connection)
or die("Couldn't execute query.");
// start results formatting
echo "<TABLE BORDER=1>";
echo "<TR>
<TH>TEST ID</TH>
<TH>TEST NAME</TH>
</TR>
";
// format results by row
while ($row = mssql_fetch_array($sql_result)) {
$test_id = $row["TESTID"];
$test_name = $row["TESTNAME"];
echo "<TR>
<TD>$test_id</TD>
<TD>$test_name</TD>
</TR>
";
}
echo "</TABLE>";
// free resources and close connection
mssql_free_result($sql_result);
mssql_close($connection);
?>
http://www.php.net/manual/ref.mssql.php