blackgold Posted August 3, 2008 Share Posted August 3, 2008 I'm a total newb, but here's my code. I have a cell colored a certain color if it's a win. I'm trying to calculate my win percentage. $test1 = mysql_query("SELECT COUNT(*) from mytable WHERE color=#ABD66F * '100'"; $test2 = mysql_fetch_row($test1); echo "$test2[0]"; Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 3, 2008 Share Posted August 3, 2008 um wow I don't even see table structure db structure or anything? we could guess at this but it just be pointless Quote Link to comment Share on other sites More sharing options...
Barand Posted August 3, 2008 Share Posted August 3, 2008 SELECT SUM(IF(color='#ABD66F', 1, 0)) * 100 / COUNT(*) FROM mytable Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.