Jump to content

Archived

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

caffeblog

Need help with Blog system

Recommended Posts

Hello.  I have a blog community system at [url=http://www.caffeblog.com]www.caffeblog.com[/url] .  I am trying to insert a Random Blog redirect into it where when a person clicks on the "Random Blog" link it will redirect them to a blog on the system.  It works almost perfect now, however sometimes it redirects the user to a blank page due to previously deleted blogs on the system.

Is there any way to overcome this issue?  ???

Len
[url=http://www.CaffeBLOG.com]www.CaffeBLOG.com[/url]

Share this post


Link to post
Share on other sites
how do you determine the random blog? the best way to do it is to run a select query ordering by random, but only select the active blogs. that way, you can feel confident that the one you link to will be a good link. make sense?

we could help you a little better if we knew how you were creating your links and retreiving your random entry

Share this post


Link to post
Share on other sites
[quote author=obsidian link=topic=110080.msg444261#msg444261 date=1159630492]
how do you determine the random blog? the best way to do it is to run a select query ordering by random, but only select the active blogs. that way, you can feel confident that the one you link to will be a good link. make sense?

we could help you a little better if we knew how you were creating your links and retreiving your random entry
[/quote]

Hello.  The rotation program is looking at a section of the mysql tables to see if an entry is there.  An active entry is a "1", a formerly active is a "0".  The blog program does not totally delete out a formerly active entry due to former username issues.  That is where I am running into the problems.  I need the rotation program to distinquish between an active entry of '1' and ignore the '0'.  I do not have the experience to know what code to put in the rotation program to do this.

Len
[url=http://www.CaffeBLOG.com]www.CaffeBLOG.com[/url]

Share this post


Link to post
Share on other sites
run a query to filter out the inactive ones and randomly choose one of those that is active:
[code]
SELECT * FROM blogPosts WHERE active = '1' ORDER BY RAND() LIMIT 1;
[/code]

Share this post


Link to post
Share on other sites
[quote author=obsidian link=topic=110080.msg444374#msg444374 date=1159641495]
run a query to filter out the inactive ones and randomly choose one of those that is active:
[code]
SELECT * FROM blogPosts WHERE active = '1' ORDER BY RAND() LIMIT 1;
[/code]
[/quote]

Thanks!  I will give that a try.

Len

Share this post


Link to post
Share on other sites

×

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.