I’m trying to run a mysql query which selects all users from a table where the rank is from 5000 to 15000. Those two have been put into variables. Let me change this into code, it’ll explain it better.
$user_rank = 10000 //this is actually a $row[''] pulled from a database
$rank_above = $user_rank + 5000;
$rank_below = $user_rank - 5000;
$fetch_users = mysql_query("SELECT * FROM users WHERE rank = '$rank_below' ?to? '$rank_above'");
However, I also want to make the result a LIMIT 1 random result, so that it only selects one random user from the users table. Am I even going about this the right way?
Any help much appreciated, thank you.
You can use the BETWEEN clause in mysql
Example: