Hi, I am assigning the numbers 1.00-10 (including decimals) to rows in my table, however when I want to add a new row, I want to see if it's number is in the top 5 results: I hope this makes some sense
I'm not sure, but I guess there's no other method that making a SELECT query with LIMIT 0, 5 at the end, going through that resultset and checking whether one of the results contains your number. Would be interested though if somebody knows another method!
you can do it SELECT * from * where *=* LIMIT 5 ASCEND i think that will pretty much do the same though, just take the first 5 numbers you get
Get the first 5: $query = mysql_query("SELECT `count_field` FROM `table_name` ORDER BY `count_field` DESC LIMIT 5"); Code (markup): Then you search through: while($query = mysql_fetch_assoc($query)){ if($query[0] == $count_field_checking_size){ echo 'Size Match'; } } PHP: