Hello, I am having to randomly sort result from my query and display paging using mysql. The sort and pagination are working perfectly.
Whenever pagination is done, because of the use of ORDER BY RAND();
, the results are random and repeated in pagination.
I would like to know how to use ORDER BY RAND();
so that the records always appear random in each query (not necessarily on each page) without repeating on the following pages.
SELECT * FROM tabela1 WHERE Id= $id ORDER BY RAND() LIMIT $inicial,$final