note 108075 rejected from book.mssql by danbrown
| From: | danbrown@php.net | Date: | Tue, 27 Mar 2012 15:33:24 +0000 |
| Subject: | note 108075 rejected from book.mssql by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186848@lists.php.net to get a copy of this message | ||
Note Submitter: richards at greenfields dot austasia dot biz
----
Dear All,
I have problem to connect php 5.3.5 with sql server 2005. I have copy the ext. sql server 2005
driver for it php and configure the php.ini and restart the apache, but still got error
Fatal error: Call to undefined function mssql_connect() in D:\xampp\htdocs\sqlserver\index.php on
line 10
herewith i send my code, thanks for your help
<?php
$serverName = "127.0.0.1,1433";
$userName = "sa";
$password = "Google1";
$dbName = "contoh";
//$server = "SERVER\INSTANCE";
$connectionInfo = array("Database"=>"contoh", "UID" =>
"sa", "PWD" => "Google1");
$conDb = mssql_connect($serverName,$connectionInfo);
// menyatakan pernyataan SQL yang akan meng-query data
$strSql = "SELECT id, name, year FROM cars";
//Jalankan query SQLnya
$result = mssql_query($strSql);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" :
"s") . " Returned </h1>";
//Tampilkan hasil query
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["name"] .
$row["year"] . "</li>";
}
//Tutup koneksi
mssql_close($conDb);
?>