PHP查询MySQL时使用了SQL查询函数,如何获得查询结果? 各位高手: 我使用的查询语句为:select sum(quantity) from table_name,在命令行环境下能够获得数量字段的汇总值,但不知在PHP中如何来操作查询得到的汇总值,请各位指教,谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select sum(quantity) AS myname from table_name$Result['myname'] 和count()的用法一个样吧, as 赋给一个随便的值其实google一下全知道 http://yp.oss.org.cn/software/show_resource.php?resource_id=87 ca。来看看。蛋疼的写个例子。<?php $conn = mysql_connect(...........); mysql_query("set names 'utf8'"); $sql = "select sum('quanlity') as sumq from table_name"; $res = mysql_query($sql); $result = mysql_fetch_array($res); $total = $result['sumq']; echo $total;?> 谁帮我改编用curl调用web service 查询搜索后分页的问题 update有个条件 求php-smallint类型的正則表达式 iis6.0运行php的问题 一个比较复杂的问题 php的一个通用文件上传的类。 phplib里怎么得到模板被替换后的全部内容 我已经在PHP.INI中定义了session.save_path = "e:\server\php\tmp"为什么还不行。(其中tmp是我新建的文件夹) yii2 runtime目录不能生成log目录,已赋读写权限 懂coreseek的高手进来 PHP中能否在一个脚本中定义变量,然后在其它脚本中调用或载入使用
其实google一下全知道 http://yp.oss.org.cn/software/show_resource.php?resource_id=87
<?php
$conn = mysql_connect(...........);
mysql_query("set names 'utf8'");
$sql = "select sum('quanlity') as sumq from table_name";
$res = mysql_query($sql);
$result = mysql_fetch_array($res);
$total = $result['sumq'];
echo $total;
?>