MesCasinos Posted February 26, 2010 Share Posted February 26, 2010 HI, - First I've attached the original PHP file, which you will need. This file is included in a page. - Second, sorry for my english, this is not my primary language Ok, the page I've attached currently dont sort the casinos: http://www.mescasinos.net/meilleurs-casinos.php In my webpage, you can see the overal rating with the stars which is the average of fields ['note_'] for each casinos, this rating is made by mathematic (line 45): $number = ($row['note_rep'] + $row['note_graph'] + $row['note_bmatch'] + $row['note_bmax'] + $row['note_bgratuit'] + $row['note_jackpot'] + $row['note_varjeux'] + $row['note_languages'] + $row['note_bloyauter'] + $row['note_jeuxmulti'] + $row['note_metpaiement'] + $row['note_metretrait'] + $row['note_support'])/13; I want to get my casinos sorted DESC by this overal rating Normaly, to get something sorted i use: $result = mysql_query("SELECT * FROM casinos ORDER BY something DESC"); But here the average is $number and i can't use it in the "mysql_query" and in the "while" This is how i think the things must be but im not sure if thats the good way to make it: should make the average of all the fields ['note_'] for each casinos in my table and sort them after Example: Table "casinos" nom note_rep note_graph note_support bonus tropez 9 6 6 100% rushmore 8 7 9 150% bellini 9 9 9 100% The average of tropez is 7.6 The average of rushmore is 8 The average of bellini is 9 so in my webpage the casinos will be sorted: bellini rushmore tropez I hope you guys understand what i want say [attachment deleted by admin] 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.