|
|
|
ช่วยด้วยครับ Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource |
|
|
|
|
|
|
|
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\Project\admin_order_view.php on line 68
โค้ดตามนี้เลยครับ ขอด่วนนะครับ ขอบคุณมากครับทุกคน
Code (PHP)
<?
$id_order=$_GET[id_order];
include "connect.php";
$sql="select * from tb_order where id_order='$id_order' ";
$result=mysql_db_query($dbname,$sql);
$rs=mysql_fetch_array($result);
$id_order=$rs[id_order];
$code_order=sprintf("%05d",$id_order);
$name_order=$rs[name_order];
$email_order=$rs[email_order];
$tel_order=$rs[tel_order];
$address_order=$rs[address_order];
$date_order=$rs[date_order];
$total_order=$rs[total_order];
?>
<html>
<head>
<title>Online Shopping for Admin</title>
</head>
<body>
<p><h3>Order</h3></p>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="101">code :</td>
<td><?=$code_order?></td>
</tr>
<tr>
<td width="101">Name :</td>
<td><?=$name_order?></td>
</tr>
<tr>
<td>Email :</td>
<td><?=$email_order?></td>
</tr>
<tr>
<td>Tel :</td>
<td><?=$tel_order?></td>
</tr>
<tr>
<td>Address :</td>
<td><?=$address_order?></td>
</tr>
<tr>
<td>Order Time</td>
<td><?=$date_order?></td>
</tr>
</table><br>
<table width="600" border="1">
<tr bgcolor="#E8E8E8">
<td width="8%"><div align="center"><b>Code</b></div>
</td>
<td width="60%"><div align="center"><b>Product Name</b></div>
</td>
<td width="10%"><div align="center"><b>Quantity</b></div>
</td>
<td width="10%"><div align="center"><b>Price</b></div>
</td>
<td width="12%"><div align="center"><b>Total</b></div>
</td>
</tr>
<?
$sql="select ref_id_prd,name_prd,number,price from tb_product, tb_order_detail where id_prd = ref_id_prd and ref_id_order='$id_order' ";
$result=mysql_db_query($dbname,$sql);
while ($rs=mysql_fetch_array($result)) { //Error บรรทัดนี้อะครับ
$ref_id_prd=$rs[ref_id_prd];
$code=sprintf("%05d",$ref_id_prd);
$name_prd=$rs[number];
$price=$rs[price];
$total_unit=$number*$price;
$total=$total+$total_unit;
echo"
<tr>
<td>$code</td>
<td> $name_prd</td>
<td><center>$number</center></td>
<td><center>$price</center></td>
<td><center>$total_unit</center></td>
</tr>";
}
?>
</table><br><? echo "Total $total Rupee"; ?><br>
</body>
</html>
Tag : PHP, MySQL, HTML/CSS, CakePHP
|
|
|
|
|
|
Date :
2011-03-22 00:14:50 |
By :
thanisornn |
View :
917 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คาดว่า Query คงจะผิดครับ ลอง echo ค่า sql แล้วเอาไปทำการทดสอบบน phpMyAdmin ดูครับ
Code (PHP)
echo $sql;
|
|
|
|
|
Date :
2011-03-22 06:28:34 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|