In the project I'm working on, I need to add up all rows data for one
column. So, I have this code:
$getprodcount = mysql_query("SELECT SUM(qty) FROM purchase");
$numproducts=$getprodcount;
Later on, I have this code: <?php print $numproducts; ?
What is being printed is Resource id #5...not the numeric value of what is
supposed to be a sum. What is wrong? I am assuming taht resource id #5 is a
pointer of some sorts to the number I am looking for, but how do you get
the actual sum number?
Thanks in advance!
--
Message posted via http://www.sqlmonster.comThis is an MSSQL group, not a MySQL group - you'll probably get a
better answer in a MySQL or PHP forum.
Simonsql
No comments:
Post a Comment