I need to do a SELECT
in PHP where X records are randomly selected. So I'm using the ORDER BY RAND()
method, but I need the LIMIT
to be one or the other depending on a variable, that is, something like this:
$sql = "SELECT * FROM table ORDER BY RAND() LIMIT = '$limite'";
I see that does not work, and I do not think I can do it with the "Prepared Statements". If possible, I would like you to apply your answer to the previous example, I would be much clearer.
Thank you.