เย้ ได้แล้วครับผมแก้ไขปัญหาตรงที่การติดต่อฐานข้อมูลได้แล้วครับ
แต่ตอนนี้มีปัญหาใหม่อีกแล้วคับว่า
Warning: mssql_query(): supplied argument is not a valid MS SQL-Link resource in c:\inetpub\wwwroot\test1.php on line 15
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in c:\inetpub\wwwroot\test1.php on line 17
แก้ไม่ตกสักทีครับ
ด้านล่างนี้คือโค้ดนะครับ
...............................
<html>
<body>
<?
$host="localhost";
$username="sa";
$password="";
$db="test";
$tb="customer";
mssql_connect( $host,$username,$password) or die ("ติดต่อกับฐานข้อมูล Mssql ไม่ได้");
mssql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$sql="Select * From $tb";
$db_query=mssql_query($db,$sql);
$num_rows=mssql_num_rows($db_query); /* นับ Reccord ที่พบ*/
?>
<table width="91%" border="1" align="center">
<tr>
<td width="8%">
<div align="center">Id</div>
</td>
<td width="12%">
<div align="center">name</div>
</td>
<td width="11%">
<div align="center">Surname</div>
</td>
</tr>
</table>
<?
$a=0;
while($a < $num_rows)
{
$result = mssql_fetch_array($db_query);
$id=$result[id];
$name=$result[name];
$surname=$result[surname];
?>
<table width="91%" border="1" align="center">
<tr>
<td width="8%">
<div align="center"><?echo"$id";?></div>
</td>
<td width="11%">
<div align="center">
</div>
</td>
<td width="10%">
</td>
<td width="12%">
<?echo"$name";?>
</td>
<td width="11%">
<?echo"$surname";?>
</td>
</tr>
</table>
<?
$a++;
}
echo"<center><br>จำนวน Reccord = $num_rows</center>";
mssql_close();
?>
</body>
</html>
............
ไม่แน่ใจว่าผมเขียนโค้ดผิดหรือป่าว แล้วผมควรแก้ตรงไหนครับ นี่แค่เรียกอ่านข้อมูลในตารางเท่านั้นนะครับทำไมมันยากจัง ยังไงก็ไม่ยอมแพ้หรอกครับ
ต้องทำให้ได้(สู้ตาย สู้ สู้
) รบกวนด้วยนะคับ