| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Comfy Contributor
Joined in Dec 2004
Lives in United Kingdom
Hosted on pass74
146 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
|
Select the rating with most rates.
Now i have five of these $rating_count_ = mysql_num_rows($query_rating_);
each with the numbers 1 to 5 after the _ now these select the amount of ratings so i have like so 1: 3 votes 2: 4 votes 3: 1 vote 4: 6 votes 5: 10 votes Nowe what i need is a way for it to check all of the number of rows like $rating_count_1 = mysql_num_rows($query_rating_1); $rating_count_2 = mysql_num_rows($query_rating_2); $rating_count_3 = mysql_num_rows($query_rating_3); $rating_count_4 = mysql_num_rows($query_rating_4); $rating_count_5 = mysql_num_rows($query_rating_5); and find the one with the most rows then display the number for it. IE. because theres 10 votes on the rating 5 it will display 5.
__________________
http://residentfantasy.com |
|
|
|
|
|
#2 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,087 posts
Gave thanks: 48
Thanked 131 times
|
Couldn't you put each into an array and then do an array rsort?
PHP Code:
Last edited by H; November 21st, 2005 at 8:59 PM.. Reason: Realized you'd want rsort rather than sort. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Comfy Contributor
Joined in Dec 2004
Lives in United Kingdom
Hosted on pass74
146 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
|
No, that never worked just showed a 1.
__________________
http://residentfantasy.com |
|
|
|