|
 |
|
select ไม่แสดงเรคคร์อดแรก เมื่อคลิกเลือกจากรายการสินค้า |
|
 |
|
|
 |
 |
|
ถามนิดครับ ชื่อสินค้าหรือว่าไรอะครับ ผมจะได้ดูได้ถูกจุดว่ามันไม่แสดงค่าอะไรครับ
|
 |
 |
 |
 |
Date :
2010-03-02 08:51:00 |
By :
SOUL |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
include("config.php");
$sql ="select code_session,code_product,group_code,type_code,quantity from session_store where code_session='".$user."'" ;
$query = mysql_query($sql);
$num = mysql_fetch_array($query);
if($num<>0){
echo"<table width='100%'>";
echo"<tr>";
echo"<td>รหัสสินต้า</td><td>รายการ </td><td>ราคา/หน่วย</td><td>จำนวน< /td><td>รวม</td>";
do {
if($result[price_discount]==null){
$h = $result[price];
}else{
$h = $result[price_discount];
}
$i += $h*$result[quantity];
$k = $h*$result[quantity];
$pd_code = $result[group_code].$result[type_code]."-".sprintf('%04d',$result[code_product]);
echo"<tr><td>$pd_code</td>";
echo"<td>$result[product_name]</td>";
echo"<td>$h</td>";
echo"<td><INPUT TYPE='text' NAME='Qty' value='$result[quantity]' class='quantity_box'></td>";
echo"<td>$k</td>";
} while($result=mysql_fetch_array($query))
echo"<tr><td><a href='index.php'>เลือกสินค้าเพิ่ม</a></td>";
echo"</table>";
}
?>
|
 |
 |
 |
 |
Date :
2010-03-02 09:45:44 |
By :
ความรู้เท่าหางอึ่ง |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
include("config.php");
$sql ="select code_session,code_product,group_code,type_code,quantity from session_store where code_session='".$user."'" ;
$query = mysql_query($sql);
//$num = mysql_fetch_array($query);
//เปลี่ยนจากตัวบนเป็น function ข้างล่างแทนเพราะถ้าใช้แบบที่คุณเขียนมันจะ fetch ค่าแถวแรกออกมาเช็คก่อน
//และเมื่อตอนไป loop แสดงค่า ค่าที่ได้เลยหายไปหนึ่งแถวครับ
$num = mysql_num_rows($query);
if($num<>0){
echo"<table width='100%'>";
echo"<tr>";
echo"<td>รหัสสินต้า</td><td>รายการ </td><td>ราคา/หน่วย</td><td>จำนวน< /td><td>รวม</td>";
while($result=mysql_fetch_array($query)){
if($result[price_discount]==null){
$h = $result[price];
}else{
$h = $result[price_discount];
}
$i += $h*$result[quantity];
$k = $h*$result[quantity];
$pd_code = $result[group_code].$result[type_code]."-".sprintf('%04d',$result[code_product]);
echo"<tr><td>$pd_code</td>";
echo"<td>$result[product_name]</td>";
echo"<td>$h</td>";
echo"<td><INPUT TYPE='text' NAME='Qty' value='$result[quantity]' class='quantity_box'></td>";
echo"<td>$k</td>";
}
echo"<tr><td><a href='index.php'>เลือกสินค้าเพิ่ม</a></td>";
echo"</table>";
}
?>
|
 |
 |
 |
 |
Date :
2010-03-02 10:17:39 |
By :
windersun |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ได้แล้วครับ ขอบคุณมากๆคับ
|
 |
 |
 |
 |
Date :
2010-03-02 12:13:20 |
By :
aek |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|