|
|
|
ต้องการทราบวิธีการใช้ php ติดต่อกับ microsoft sqlserver 2005 |
|
|
|
|
|
|
|
<?php
$objConnect = mssql_connect(".\sqlexpress","","") or die("Error Connect to Database");
$objDB = mssql_select_db("morality")or die("not select");-----ติดตรงนี้คับ
$query = "SELECT id_course FROM course";
$objQuery = mssql_query($query) or die ("Error Query [".$strSQL."]");
while($objResult = mssql_fetch_array($objQuery))
{
echo $objResult ."<br>";
}
mssql_close($objConnect);
?>
คือผมทำแล้วมันติดอ่ะคับ
|
|
|
|
|
Date :
2010-08-10 20:22:11 |
By :
ohohae |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sql server มันไม่ใส่ user ได้ด้วยหรอครับ
|
|
|
|
|
Date :
2010-08-11 01:53:05 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$db = "morality";
$objConnect = mssql_connect(".\sqlexpress","","") or die("Error Connect to Database");
$objDB = mssql_select_db($db) or die("not select");
$query = "SELECT id_course FROM course";
$objQuery = mssql_query($query) or die ("Error Query [".$strSQL."]");
while($objResult = mssql_fetch_array($objQuery))
{
echo $objResult ."<br>";
}
mssql_close($objConnect);
?>
ลองดูครับ
|
|
|
|
|
Date :
2010-08-11 09:50:21 |
By :
pob_suwan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|