Help to stop randomizing search results across mulitple pages

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 15, 2010   (RSS)

Re: [rentittoday] Help to stop randomizing search results across mulitple pages

By Chris - September 13, 2010 - edited: September 15, 2010

Hi Lauren,

Here's a sneaky solution for you.

// if the visitor doesn't have a random_string, assign them a new one
if (!@$_SESSION['random_string']) { $_SESSION['random_string'] = uniqid(''); }

// load records
list($exampleRecords, $exampleMetaData) = getRecords(array(
'tableName' => 'example',
'perPage' => '5',
'orderBy' => mysql_escapef('MD5(CONCAT(?, num))', $_SESSION['random_string']),
));


Does that help? Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Help to stop randomizing search results across mulitple pages

Thanks for the response!
We added this code and are getting a
"Notice: Undefined index: random_string...." error.

I am not that familiar with this sessions stuff. But, from what I assume we are getting this error because "random_string" is not defined anywhere. The issue is we do not know where or how to define this variable correctly.

Any more help would be greatly appreciated :)

Lauren
Jason Glass

Re: [rentittoday] Help to stop randomizing search results across mulitple pages

By Chris - September 15, 2010 - edited: September 15, 2010

Hi Lauren,

The first line there is meant to define the 'random_string' element if it's not already defined:

if (!@$_SESSION['random_string']) { $_SESSION['random_string'] = uniqid(''); }

Could you email me your FTP information and I'll see if I can get this figured out for you? chris@interactivetools.com
All the best,
Chris