Re: [PHP-DB] Getting total quantities
[email protected] (Chris)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
Karl DeSaulniers wrote: > Would it be? > > $q = "SUM(ProductStock) FROM products"; > > or > > $q = "SELECT SUM(ProductStock) AS ProductStock FROM products"; > > if I want to return $ProductStock as the value? This one. The "AS" gives it an alias (or shortcut) to make it easier to find in mysql_fetch_array etc. -- Postgresql & php tutorials http://www.designmagick.com/