Jump to content

pagnation but with random order remembered?


jesushax

Recommended Posts

hi all hope i make sense here, personally i dont see how it can be done, but will ask if anyones got an idea anyway.

 

at the moment everyone in the directory is listed alphabetically, which is unfair on members really, only ones beginging with A are every going to make the front page, i need a more fair way of doing it.

 

i though of using random, then everyone would get a go, but with using pagnation if a user clicked page 2 another set of random records would appear, not the orginal random list.

 

how could we create a random list and keep that list for pagnation?

 

below current code

 

$Trade = urldecode($_GET["Trade"]);

$max = 10; 
$p = @$_GET['p'];
if(empty($p))
{
$p = 1;
}
$limits = ($p - 1) * $max; 

$SQL = mysql_query("SELECT * FROM tblDirectory2 WHERE Sect1_2 LIKE '%$Trade%' ORDER BY Sect1_4 ASC LIMIT ".$limits.",$max") or die (mysql_error());

$totalres = mysql_result(mysql_query("SELECT COUNT(CompanyID) AS tot FROM tblDirectory2 WHERE Sect1_2 LIKE '%$Trade%' "),0);	

$totalpages = ceil($totalres / $max); 

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.