1

How would i search for a random number between two numbers by mysql query. This is not a valid mysql command this just for understanding.

$number = 3600;
$aa = 3300;
$bb = 4000;
$query = "Search for the $number between $aa AND $bb";

How would i do this with php and mysql.

1 Answer 1

3

Try

SELECT * FROM `table_name` WHERE `number` BETWEEN '$aa' AND '$bb'

See the manual entry for BETWEEN.

This is just the MySQL query. How you call it in PHP depends on your framework. E.g. you could use PDO.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.