Pezmc Posted January 25, 2007 Share Posted January 25, 2007 In my database I have lots of song names as below[CODE] id title artist album submitter submitterip online votes code sumbiteremail1 Don't Stop Me Now Queen The Complete Queen Collection Pez Cuckow 192.168.0.3 yes 3 2 Eternal Clerking Amatatuer Transplants Fitness To Practice Pez Cuckow 192.168.0.3 yes 1 3 Moments In Love (Quiet Storm) Art Of Noise Art of Noise Pez Cuckow 192.168.0.3 yes 1 4 Moments In Love (Quiet Storm) Art Of Noise Art of Noise Pez Cuckow 192.168.0.3 yes 1 5 You gotta Tap Audiobody Sound. Motion. Theater. Pez Cuckow 192.168.0.3 yes 1 6 Sweet Harmony The Beloved Open Space Pez Cuckow 192.168.0.3 yes 5 [/CODE]Sorry about misaligning,On the home page I have these in order of votes and then run this statement to color code them;[code=php:0]$numone = $num/100*20;$numtwo = $num/100*40;$numthree = $num/100*60;[/code]And in the query[code=php:0]if ($rank < "$numone") { $color = "bgcolor=\"#009900\""; } elseif ($rank > "$numone" && $rank < "$numtwo") {$color = "bgcolor=\"#FF6600\""; } elseif ($rank > "$numtwo" && $rank < "$numthree") {$color = "bgcolor=\"#CC3300\""; } elseif ($rank > "$numthree") {$color = "bgcolor=\"#CC0000\""; }$rank++;[/code]I have now made a search box but would still like it to be color coded from the colors on this page, is there a way I can perform a mysql query to find my songs "rank" by votes and then color it using the thing above, so It makes if easier for my users to understand? Working example can be found here: http://labs.pezmc.com/radio/songlist.php Link to comment https://forums.phpfreaks.com/topic/35638-checking-the-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.