Jump to content

Need help with Blog system


caffeblog

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]
Link to comment
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
Link to comment
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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.