|
![](/images/resource/spacer.gif) |
|
ช่วยเติมโค้คให้ผมหน่่อยคับ ให้สามารถแสดงเลขลำดับกำกับแถวอ่ะคับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
$sql = "SELECT product.pro_no AS สินค้าและบริการ,vendors.ven_name AS 'ชื่อผู้ขาย',contact.con_fname AS ชื่อผู้ติดต่อ, contact.con_lname AS นามสกุล, vendors.ven_add AS 'ที่อยู่',vendors.ven_tel AS 'เบอร์โทรศัพท์', vendors.ven_fax AS 'โทรสาร',evaluationscore AS 'ส.ค.' FROM vendors,contact,product WHERE vendors.con_id = contact.con_id AND vendors.ven_id = product.ven_id;";
$result = mysql_query($sql);
echo "<table border=2 align=center cellpadding=2 cellspacing=0 >";
echo "<tr bgcolor=#CCCCCC>";
$num_fields = mysql_num_fields($result);
for ($i = 0 ; $i < $num_fields ; $i++){
echo "<th>".mysql_field_name($result,$i)."</th>";
}
echo "</tr>";
while ($data = mysql_fetch_array($result)){
echo "<tr valign=top>";
for ($i = 0 ; $i < $num_fields ; $i++){
echo "<td>".$data[$i]."</td>";
}
echo "</tr>";
}echo "</table>";
mysql_close();
ปล.ผมต้องการให้มีเลขกำกับแต่ละแถว ให้ใช้ชื่อคอลัมว่า ลำดับ
แต่โค้ดข้างบนนี้ยังไม่มีเลขกำกับแถว
Tag : PHP, jQuery, Windows
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2012-08-28 15:45:55 |
By :
auppawong |
View :
1087 |
Reply :
2 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ไม่ยากครับ
Code (PHP)
$i=1; //ตัวนี้คือลำดับ
while ($data = mysql_fetch_array($result)) วน loopข้อมูลตัวไหนของนายก้อว่าไปนะ
{
echo $i;
$i++; //เพิ่มค่าลำดับ เมื่อวน loopครบ1รอบ
}
นายจัดรุปแบบเอาเองนะอิอิขี้เกียด ปะมานนี้อะ
|
ประวัติการแก้ไข 2012-08-28 16:03:35 2012-08-28 16:04:38
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2012-08-28 16:03:11 |
By :
sambrazil |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ใช้ชื่อภาษาไทย เท่ดีครับ ![](/images/bbcode/grin.gif?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2012-08-28 20:40:12 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 00
|