Random display of entries

7 posts by 2 authors in: Forums > CMS Builder
Last Post: December 9, 2009   (RSS)

Re: [tsuluwerks] Random display of entries

By Dave - December 9, 2009

Hi tsuluwerks,

What's happening is that it's loading 1 random record (regardless of category), and then if it's not in the right category it's not showing it.

Try this where to only get records that are in the category Shameless:
'where' => " categories LIKE '%\tShameless\t%' ",

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Random display of entries

By tsuluwerks - December 9, 2009

Hi, Dave:

Unfortunately, it did not work. A sample of the results can be found at http://www.tsuluwerks.com/shamelessyou/. If the page is refreshed, sometimes a quote shows up, sometimes it doesn't.

What do you think?

Re: [tsuluwerks] Random display of entries

By Dave - December 9, 2009

Try adding this line to see what the database query is returning:

<?php showme($quotesRecords); ?>

Let me know what that says.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Random display of entries

By tsuluwerks - December 9, 2009

I received this reply

Fatal error: Call to undefined function: showme() in E:\USERS\tsuluwerksinc\www\common\quotes-shameless.php on line 26

Re: [tsuluwerks] Random display of entries

By tsuluwerks - December 9, 2009

Wait, I think it's working. I just clicked the "refresh" button about 20 times, each time with successful results.

Re: [tsuluwerks] Random display of entries

By Dave - December 9, 2009

Ahh, ok, you must have an older version. Try this:

<?php
print "<xmp>";
print_r($quotesRecords);
print "</xmp>";
?>

The idea is to see where the bad data is coming from. That will show you the contents of the data being loaded from the database. If it looks right then it must be something in the viewer code on the page.

If it doesn't look right then we need to look at the where being used to load the records.

Hope that helps! Let me know what that says.
Dave Edis - Senior Developer
interactivetools.com