note 106165 modified in function.array-sum by danbrown
| From: | danbrown@php.net | Date: | Sat, 15 Oct 2011 21:18:57 +0000 |
| Subject: | note 106165 modified in function.array-sum by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183905@lists.php.net to get a copy of this message | ||
As mysql_fetch_array returns associative and numeric indexes, you can simply use a flag.
<?php
$result = mysql_query("SELECT id, name FROM mytable");
$row = mysql_fetch_array($result, MYSQL_NUM);
array_sum($row);
?>
Hope it helps.
--was--
As mysql_fetch_array returns associative and numeric indexes, you can simply use a flag.
$result = mysql_query("SELECT id, name FROM mytable");
$row = mysql_fetch_array($result, MYSQL_NUM);
array_sum($row);
Hope it helps.
http://php.net/manual/en/function.array-sum.php