qty
我的表中有列,并且我想总结qty
此列中的所有变量:
$get_sold = "select qty from pending_orders where product_id='$p_id' AND order_status=='done'";
$result = mysqli_query($con, $get_sold);
首先,你需要通过总结你列的查询sum(qty)as totals
,并删除==
从order_status
它=
您需要使用mysqli_fetch_row
将总和数据放入变量
<?php
$get_sold = "select sum(`qty`)as totals from `pending_orders` where `product_id`='".$p_id."' AND `order_status`='done'";
$result = mysqli_query($con,$get_sold);
$row=mysqli_fetch_row($result);
$row[0];// get your total sum
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句