I have a table of product. I have listed the items with pagination using rand() function. When using rand(), it displays the items in random order but the record is repeated while we go from 1 page to another page. Is it possible to get non repeated items in each page using rand()? If yes how, if no what may be the option for this.
Well, you could generate a random seed when doing the first query (in your app code), and then keep that seed between requests - and supply this seed to the rand([seed])
function. That should do it...
Of course, the specifics would depend on how exactly your sql code is working at the moment; you might need to loop to comsume the first page (or so) of random numbers to ignore.
In a situation like that, I might see if there's a way to create a list of the product IDs (I'm assuming each product has some sort of unique ID) and shuffle it. The list might be stored as a temporary database table or it might be stored as a session variable in your web application, for example... that way you could get access to any part of the randomly ordered list without having to recompute the whole thing from the beginning.
This is obviously best if you have few people accessing the site at any given time, but you expect each of them to go through several pages of the results.