SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 27th, 2002, 01:10 PM
littleblackdog littleblackdog is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Anchorage
Posts: 118 littleblackdog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Counting total in column ...problem

I've been working with this little problem for some time now...here is as close as I've come:

PHP Code:
<?php
$db_name 
"aqua_books";
$table_name "bookinput";
$quantity "quantity";
$connection = @mysql_connect("localhost""user""password") or die(mysql_error());
$db = @mysql_select_db($db_name$connection) or die(mysql_error());
$query mysql_query("SELECT COUNT($quantity) FROM $table_name");
$rows mysql_result($query00);
echo 
"<strong>" .$rows"</strong>";
?>


This only prints "3" since there are three book titles in the database.

I am looking for the number of books total (quantity) the column "quantity" is an INT with currently 22 total books. One cell has 20 books, all with same title...

Any suggestions?
Thanks for everyones help.
__________________
bow wow!

Reply With Quote
  #2  
Old November 27th, 2002, 01:51 PM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Instead of using COUNT($quantity) try using SUM($quantity). That should give you the summation of all the numbers in the quantity field.
__________________
Oh I wish, I wish I hadn't killed that fish...

Reply With Quote
  #3  
Old November 27th, 2002, 02:03 PM
littleblackdog littleblackdog is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Anchorage
Posts: 118 littleblackdog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Smile THAT DID IT!

That did it! SUM($quantity) did the trick! Thanks to markerdave and everyone else at this forum who takes the time to help.

Happy Thanksgiving!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Counting total in column ...problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway