ช่วยดูโค้ดการวนลูปให้หน่อยค่ะ การวนลูปนำค่าออกมาใน php ค่ะ
โค้ดค่ะ จากโค้ดคือจะวนลูปแสดงค่าออกมาแค่แถวแรก แถวต่อไปไม่แสดงค่าเลยค่ะ รบกวนช่วยดูให้หน่อยค่ะ
<?
session_start();
header("content-type:application/x-javascript;charset=tis-620");
require("../connect/connect_inc.php");
require("../class/class_memberclub.php");
$IdMember =$_COOKIE[idmember];
$active = $_COOKIE[active];
$selectT = "SELECT * FROM typeorderstatus ";
$queryT = mysql_db_query("otop",$selectT);
if($active == 2){// businessmember
$sql = "select * from detailorder INNER JOIN typeorderstatus ON(detailorder.IdOrderStatus = typeorderstatus.IdOrderStatus) where BusinessMemberId = $IdMember";
}else if($active ==3){
$sql ="SELECT * FROM productsotop INNER JOIN orderlist ON(productsotop.ProductsId = orderlist.ProductsId) INNER JOIN detailorder ON(orderlist.IdOrder= detailorder.IdOrder) where productsotop.IdMember= $IdMember GROUP BY detailorder.IdOrder";
}else{
$sql="select * from detailorder INNER JOIN typeorderstatus ON(detailorder.IdOrderStatus = typeorderstatus.IdOrderStatus)";
}
$result=mysql_db_query("otop",$sql);
$number=mysql_num_rows($result);
$no=1;
?>
<HTML>
<BODY>
<?
if($number<>0) {
?>
<p align="center" >ใบสั่งซื้อสินค้า</p>
<table border="1" width="90%">
<TR BGCOLOR=#E8E8E8>
<TD width="10%"><CENTER><B>รหัสใบสั่งซื้อ</B></CENTER></TD>
<TD width="15%"><CENTER><B>ชื่อ-นามสกุล</B></CENTER></TD>
<TD width="10%"><CENTER><B>จำนวนที่สั่งซื้อ</B></CENTER></TD>
<TD width="10%"><CENTER><B>ราคารวม</B></CENTER></TD>
<TD width="15%"><CENTER><b>วันที่สั่งซื้อสินค้า<b></CENTER></TD>
<TD width="15%"><CENTER><b>สถานะการสั่งซื้อสินค้า</b></CENTER></TD>
<?php
if($active==3){
?>
<TD width="20%"><CENTER><B>แก้ไขสถานะการสั่งซื้อสินค้า</B></CENTER></TD>
<TD width="10%"><CENTER><B>[ลบ]</B></CENTER></TD>
<?php
}
?>
</TR>
<?php
while($rs=mysql_fetch_array($result)) {
$IdOrder =$rs ['IdOrder'];
$code_order=sprintf("%05d",$IdOrder);
$total_order=$rs['total_order'];
$idmember = $rs['BusinessMemberId'];
$NameOrderStatusD = $rs['NameOrderStatus'];
$IdOrderStatusD = $rs['IdOrderStatus'];
$NumberProducts= $rs['NumberProducts'];
$total_order = $rs['total_order'];
$DateOrder = $rs['DateOrder'];
$viewbusiness = new memberclub;
$resultview = $viewbusiness->view3($idmember);
$lname= $resultview['Lname'];
$fname=$resultview['Fname'];
$Address= $resultview['Address'];
$TumbonName = $resultview['TumbonName'];
$AmphurName =$resultview['AmphurName'];
$ProvinceName = $resultview['ProvinceName'];
$ProvinceCode= $resultview['ProvinceCode'];
$Phone= $resultview['Phone'];
$Email = $resultview['Email'];
?>
<TR>
<TD align="center"><A HREF="../Equiment/admin_order_view.php?id_order=<?=$IdOrder?>" TARGET="_blank"><?=$code_order?></A></TD>
<TD align="left"><?=$fname?> <?=$lname?></TD>
<TD><CENTER><?=$NumberProducts?></CENTER></TD>
<TD><CENTER><?=$total_order?></CENTER></TD>
<TD><CENTER><?=$DateOrder?></CENTER></TD>
<?php
if($active==2||$active==1){
?>
<TD width="20%"><CENTER><?=$NameOrderStatusD?></CENTER></TD>
<?php
}
if($active==3){
?>
<td>
<select name='TProduct'>
<option >เลือกสถานะการสั่งซื้อสินค้า</option>
<?php
while($fetch = mysql_fetch_array($queryT)){
$IdOrderStatus = $fetch['IdOrderStatus'];
$NameOrderStatus= $fetch['NameOrderStatus'];
if($IdOrderStatusD == $IdOrderStatus){
echo "<option value='$IdOrderStatus' selected>$NameOrderStatus</option>";
}else{
echo "<option value='$IdOrderStatus'>$NameOrderStatus</option>";
}
}
?>
</select>
</td>
<td align='center'><input type='submit' name='DETAIL' value='แก้ไขสถานะ' /></td>
<TD align="center"><A HREF="../Equiment/admin_order_delete.php?id_order=<?=$IdOrder?>"
onclick="return confirm('ยืนยันลบใบสั่งซื้อสินค้า<?=$code_order ?>ออกจากระบบ')">[ลบ]</A></TD>
<?php
}
?>
</TR>
</TR>
<?php
$no++;
}
?>
</TABLE>
<?php
mysql_close();
}
?>
</BODY>
</HTML>
<?
session_start();
header("content-type:application/x-javascript;charset=tis-620");
require("../connect/connect_inc.php");
require("../class/class_memberclub.php");
$IdMember =$_COOKIE[idmember];
$active = $_COOKIE[active];
$selectT = "SELECT * FROM typeorderstatus ";
$queryT = mysql_db_query("otop",$selectT);
if($active == 2){// businessmember
$sql = "select * from detailorder INNER JOIN typeorderstatus ON(detailorder.IdOrderStatus = typeorderstatus.IdOrderStatus) where BusinessMemberId = $IdMember";
}else if($active ==3){
$sql ="SELECT * FROM productsotop INNER JOIN orderlist ON(productsotop.ProductsId = orderlist.ProductsId) INNER JOIN detailorder ON(orderlist.IdOrder= detailorder.IdOrder) where productsotop.IdMember= $IdMember GROUP BY detailorder.IdOrder";
}else{
$sql="select * from detailorder INNER JOIN typeorderstatus ON(detailorder.IdOrderStatus = typeorderstatus.IdOrderStatus)";
}
$result=mysql_db_query("otop",$sql);
$number=mysql_num_rows($result);
$no=1;
?>
<HTML>
<BODY>
<?
if($number<>0) {
?>
<p align="center" >ใบสั่งซื้อสินค้า</p>
<table border="1" width="90%">
<TR BGCOLOR=#E8E8E8>
<TD width="10%"><CENTER><B>รหัสใบสั่งซื้อ</B></CENTER></TD>
<TD width="15%"><CENTER><B>ชื่อ-นามสกุล</B></CENTER></TD>
<TD width="10%"><CENTER><B>จำนวนที่สั่งซื้อ</B></CENTER></TD>
<TD width="10%"><CENTER><B>ราคารวม</B></CENTER></TD>
<TD width="15%"><CENTER><b>วันที่สั่งซื้อสินค้า<b></CENTER></TD>
<TD width="15%"><CENTER><b>สถานะการสั่งซื้อสินค้า</b></CENTER></TD>
<?php
if($active==3){
?>
<TD width="20%"><CENTER><B>แก้ไขสถานะการสั่งซื้อสินค้า</B></CENTER></TD>
<TD width="10%"><CENTER><B>[ลบ]</B></CENTER></TD>
<?php
}
?>
</TR>
<?php
while($rs=mysql_fetch_array($result)) {
$IdOrder =$rs ['IdOrder'];
$code_order=sprintf("%05d",$IdOrder);
$total_order=$rs['total_order'];
$idmember = $rs['BusinessMemberId'];
$NameOrderStatusD = $rs['NameOrderStatus'];
$IdOrderStatusD = $rs['IdOrderStatus'];
$NumberProducts= $rs['NumberProducts'];
$total_order = $rs['total_order'];
$DateOrder = $rs['DateOrder'];
$viewbusiness = new memberclub;
$resultview = $viewbusiness->view3($idmember);
$lname= $resultview['Lname'];
$fname=$resultview['Fname'];
$Address= $resultview['Address'];
$TumbonName = $resultview['TumbonName'];
$AmphurName =$resultview['AmphurName'];
$ProvinceName = $resultview['ProvinceName'];
$ProvinceCode= $resultview['ProvinceCode'];
$Phone= $resultview['Phone'];
$Email = $resultview['Email'];
?>
<TR>
<TD align="center"><A HREF="../Equiment/admin_order_view.php?id_order=<?=$IdOrder?>" TARGET="_blank"><?=$code_order?></A></TD>
<TD align="left"><?=$fname?> <?=$lname?></TD>
<TD><CENTER><?=$NumberProducts?></CENTER></TD>
<TD><CENTER><?=$total_order?></CENTER></TD>
<TD><CENTER><?=$DateOrder?></CENTER></TD>
<?php
if($active==2||$active==1){
?>
<TD width="20%"><CENTER><?=$NameOrderStatusD?></CENTER></TD>
<?php
}
if($active==3){
?>
<td>
<select name='TProduct'>
<option >เลือกสถานะการสั่งซื้อสินค้า</option>
<?php
while($fetch = mysql_fetch_array($queryT)){
$IdOrderStatus = $fetch['IdOrderStatus'];
$NameOrderStatus= $fetch['NameOrderStatus'];
if($IdOrderStatusD == $IdOrderStatus){
echo "<option value='$IdOrderStatus' selected>$NameOrderStatus</option>";
}else{
echo "<option value='$IdOrderStatus'>$NameOrderStatus</option>";
}
}
?>
</select>
</td>
<td align='center'><input type='submit' name='DETAIL' value='แก้ไขสถานะ' /></td>
<TD align="center"><A HREF="../Equiment/admin_order_delete.php?id_order=<?=$IdOrder?>"
onclick="return confirm('ยืนยันลบใบสั่งซื้อสินค้า<?=$code_order ?>ออกจากระบบ')">[ลบ]</A></TD>
<?php
}
?>
</TR>
</TR>
<?php
$no++;
}
?>
</TABLE>
<?php
mysql_close();
}
?>
</BODY>
</HTML>
ได้แล้วจ้า
ยังไม่ทันตอบเลย
ทำไงอ่ะ บอกมั่งจิ