|
 |
|
ดึงข้อมูลมาแสดงไม่ได้คะ ช่วยดูโค๊ดให้หน่อยนะคะ ขอบคุนคะ |
|
 |
|
|
 |
 |
|
Code (PHP)
$sql = "SELECT id,name_TH,order FROM onegram ORDER BY id ASC";
$result = mysql_query($sql) or die(mysql_error);
$num_record = mysql_num_rows($result);
echo"<table border=\"1\" >
<tr>
<th>id_id</th>
<th>name</th>
<th>order</th>
</tr>";
while($dbarr = mysql_fetch_array($result))
{
echo"<tr>
<td><? echo $dbarr ['id']; ?> </td>
<td><? echo $dbarr ['name']; ?> </td>
<td><? echo $dbarr ['order']; ?></td>
</tr>";
}
echo"totel "."$num_record ";
break;
}
}
เปลี่ยนจาก $result เป็น $dbarr ลองดูครับ
|
 |
 |
 |
 |
Date :
2011-12-28 22:29:53 |
By :
gogo01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพิ่มเติม.......
ดูตรงนี้นะค่ะ while($dbarr = mysql_fetch_array($result))
เวลาใช้ mysql_fetch_array ให้ค่าเท่ากับอะไร เวลาแสดงก็ให้ค่าเท่ากับ นั่นด้วย ตามด้วย สิ่งที่มาจาก database
เช่น $src=mysql_fetch_array($sql); เวลาจะให้แสดงผล ก็คือ $src['ค่าที่เรา ทำการ select เท่านั้น'] เช่น<?= $src['id'];?>
การใช้ while คือการแสดงทั้งหมด นะค่ะอย่าลืม ผิดพลาดประการใด ขออภัยมา ณ. ที่นี้ด้วยค้า.... อิอิ
|
 |
 |
 |
 |
Date :
2011-12-28 22:35:51 |
By :
เจ้าปัญหา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$sql = "SELECT id,name_TH,order FROM onegram ORDER BY id ASC";
$result = mysql_query($sql) or die(mysql_error);
$num_record = mysql_num_rows($result);
echo"<table border=\"1\" >
<tr>
<th>id_id</th>
<th>name</th>
<th>order</th>
</tr>";
while($dbarr = mysql_fetch_array($result))
{
echo"<tr>
<td><? echo $dbarr ['id']; ?> </td>
<td><? echo $dbarr ['name_TH']; ?> </td>
<td><? echo $dbarr ['order']; ?></td>
</tr>";
}
echo"totel "."$num_record ";
break;
}
}
ถ้าไม่ได้ ให้เอารูปในฐานข้อมูลมาดูด้วยจะดีมากเลยครับ
|
 |
 |
 |
 |
Date :
2011-12-29 08:02:47 |
By :
yogolas |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|