[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 08-27-2006, 07:09 AM   #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Join Date: Jan 2005
Location: UK
Posts: 2,390
316.50 NP$ (Donate)

PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice


mysql count an acctual value:

I have this code at the moment:

PHP Code:
$sql = "SELECT user_id, count(points) AS count_points FROM trans WHERE type_id!='30' AND type_id!='40' GROUP BY user_id ORDER BY count_points DESC LIMIT 100";
but it isn't acctually counting the points. count_points to acctually be a tally of the amount of points each unique user_id has. Everytime a user earns points it is stored into the database, so it needs to add the value of every "point" field for that specific user!

Any help would be most appreciated.

Thanks
Tom
PoorDoggie is offline  
Old 08-27-2006, 07:29 AM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
 
Join Date: Aug 2005
Location: Web 1.0
Posts: 6,284
1,095.94 NP$ (Donate)

sdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond repute

Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer
It looks OK at first glance.
Did you try without the WHERE clause ?
__________________
Buy now - MassDeveloper.com $500
sdsinc is offline  
Old 08-27-2006, 07:43 AM   #3 (permalink)
Senior Member
 
Scott's Avatar
 
Join Date: Jun 2003
Location: UK
Posts: 3,773
58.82 NP$ (Donate)

Scott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond repute

Save The Children Save The Children Save The Children Save The Children Save The Children
use sum(points) instead of count(points)
Scott is offline  
Old 08-27-2006, 09:19 AM   #4 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Join Date: Jan 2005
Location: UK
Posts: 2,390
316.50 NP$ (Donate)

PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice


thanks scott

sdsinc thanks for your help - but the where clause is pretty important, and if I took it out... well but thanks
PoorDoggie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:40 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85