如何获取sql的SUM()值?紧急!在线等!本人太菜
有一个表test1
字段名num
有三个字段 111 222 333
$sql=mysql_query("select SUM(num) from test1");
$a=xxx($sql);
接下来该用哪个函数xxx把666这个数取出来赋予变量啊???
万分感激
[解决办法]
sql=mysql_query("select SUM(num) as t_sum from test1");
$res = mysql_fetch_array()
echo $res[t_sum]
[解决办法]
$a=mysql_fetch_array($sql);
echo "<pre>";
print_r($a);
echo "</pre>";
[解决办法]
sql=mysql_query("select SUM(num) as sum from test1");
$res = mysql_fetch_array()
echo $res[sum]