ปัญหา error code ว่า mysql_fetch_assoc(): ครับ มือใหม่ช่วยทีครับ
พี่ๆครับ มันขึ้นว่า
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\sale_notebook\admin\frm_money_transfer.php on line 104
ตัวโค้ด
Code (PHP)
<style type="text/css">
<!--
.style7 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
-->
</style>
<p> </p>
<p><br class="cl" />
<?
$result=mysql_query("select * from `money_transfer` where id_money_transfer='$_GET[id]' ");
$arr=mysql_fetch_assoc($result);
?>
</p>
<table width="681" height="199" align="center">
<tbody><tr>
<td height="17"><div align="right" class="style7"><span class="style10">ชื่อ </span>:<br>
</div></td>
<td>
<span class="style7"> <? echo $arr['fname'];?></span> </td>
</tr>
<tr>
<td height="17"><div align="right" class="style7"><span class="style10">นามสกุล :</span><br>
</div></td>
<td>
<span class="style7"><? echo $arr['lname'];?></span> </td>
</tr>
<tr>
<td height="17"><div align="right" class="style7"><span class="style10">เบอร์โทรติดต่อ :</span><br>
</div></td>
<td>
<span class="style7"><? echo $arr['phone'];?></span> </td>
</tr>
<tr>
<td width="39%" height="28"><div align="right" class="style7"><span class="style10">ธนาคารที่ท่านโอนเงิน :</span><br />
</div></td>
<td width="61%"><span class="style7"><? echo $arr['bank'];?></span></td>
</tr>
<tr>
<td height="17"><div align="right" class="style7"><span class="style10">หมายเลขการสั่งซื้อ :</span></div></td>
<td><span class="style7"><? echo $arr['invoice'];?></span> </td>
</tr>
<tr>
<td height="24"><div align="right" class="style7"><span class="style10">จำนวนเงินที่โอน :</span><br>
</div></td>
<td><span class="style7"><? echo $arr['money'];?>
บาท </span></td>
</tr>
<tr>
<td height="20"><div align="right" class="style7"><span class="style10">วันที่ทำการโอนเงิน :</span><br>
</div></td>
<td><span class="style7"><? echo $arr['date'];?></span></td>
</tr>
<tr>
<td height="27"><div align="right" class="style7"><span class="style10">อีเมล์ :</span><br>
</div></td>
<td><span class="style7"><? echo $arr['email'];?></span></td>
</tr>
</tbody></table>
<table >
<td align="center"><input type="submit" value="รายการสั่งสินค้า" class="bgbtgray1" /></td>
<p> </p>
</table>
<p><br />
</p>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="center"> </td>
<td align="center">จำนวน</td>
<td align="center"> </td>
<td>ชื่อสินค้า</td>
<td align="right">ราคา</td>
<td align="right" nowrap="nowrap" width="80">รวม </td>
</tr>
<?php
$sql="select t.id_product,p.stock,p.name_product,p.price,p.weight,t.qty,(select name_photo from `product_photo` where id_product=p.id_product order by orderby_img limit 1) as name_photo from `orders_item` t left join `products` p on t.id_product=p.id_product where t.`id_order`='$_GET[id]' group by p.id_product";
$result=mysql_query("$sql");
while($as=mysql_fetch_assoc($result)):
?>
<tr> </tr>
<tr class="tbdata">
<td align="center"><a href="?p=del-cart&name=<?php echo $_GET['name'];?>&id_product=<?php echo $as['id_product'];?>"><?php echo $as['weight']?></a></td>
<td align="center"><?php echo $as['qty'];?></td>
<td align="center"><img src="../images_products/<?php echo $as['name_photo'];?>" border="0" width="100" alt=""/></td>
<td><?php echo $as['name_product'];?></td>
<?php /*?><td align="center"><?php echo $as['product_no'];?></td><?php */?>
<td align="right"><?php echo $as['price'];?></td>
<td align="right" width="80"><?php echo $as['price']*$as['qty'];?></td>
</tr>
<?php
$as['weightds']=$as['weight']*$as['qty'];
$wtotal=$wtotal+$as['weightds'];
$subtotal=$subtotal+($as['price']*$as['qty']);
$id_shipping=$as['id_shipping'];
endwhile;
?>
<?php
$spp=mysql_query("SELECT * FROM shipping WHERE name_shipping between $wtotal AND $wtotal+0.9");
$shh=mysql_fetch_assoc($spp);
$shis=$shh['name_shipping'];
$shisw=$shh['price_shipping'];
$retax=mysql_query("select t.price_tax from `tax` t");
$atax=mysql_fetch_assoc($retax);
$reship=mysql_query("select s.price_shipping from `shipping` s where s.id_shipping='$id_shipping'");
$asship=mysql_fetch_assoc($reship);
$tax=$atax['price_tax'];
$shipping=$asship['price_shipping'];
?>
<tr></tr>
<tr class="tbfooter">
<td colspan="4" align="right">รวม:<?php echo "ช่วง>>".$shis."ผลรวมเท่ากับ>>".$shisw.""; ?></td>
<td colspan="2" align="right"><?php echo number_format($subtotal,2);?></td>
</tr>
<tr>
<td colspan="5" align="right">ภาษี:</td>
<td align="right" width="80"><? if($tax!=0){
$percent=($subtotal/100)*$tax;
// echo $tax; echo " %";
echo number_format($percent,2);
}else{ echo "";}?></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="right">ค่าจัดส่ง:</td>
<td align="right" width="80"><?php echo $shisw.""; ?></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="right"><strong>รวมทั้งหมด:</strong></td>
<td align="right" width="80"><strong>
<?php
$basket_total=($percent+$subtotal)+$shipping;
$basket_totalw=$shisw+$basket_total;
//echo number_format($basket_total,2);
?>
</strong>
<?php
echo number_format($basket_totalw,2);
?></td>
</tr>
</tbody>
</table>
</form>
Tag : PHP, CakePHP
Date :
2011-06-18 19:08:47
By :
Ban
View :
900
Reply :
5
ลองแก้เป็น
$spp=mysql_query("SELECT * FROM shipping WHERE name_shipping between $wtotal AND ( $wtotal+0.9) ") or die(mysql_error()) ;
Date :
2011-06-18 19:24:49
By :
PlaKriM
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (+0.9)' at line 1
ช่วยอีกนิดนะครับพี่ ขอบคุณมากๆครับ
Date :
2011-06-18 19:58:00
By :
Ban
$wtotal ไม่มีค่าครับ
Date :
2011-06-18 20:39:26
By :
PlaKriM
$wtotal=0;
$subtotal=0;
$id_shipping=0;
$result=mysql_query("$sql"); => $result=mysql_query($sql) or die(mysql_error());
while($as=mysql_fetch_assoc($result)):
ประวัติการแก้ไข 2011-06-19 11:53:02 2011-06-19 11:53:40
Date :
2011-06-19 11:51:52
By :
sakuraei
Load balance : Server 01