caffeblog Posted September 30, 2006 Share Posted September 30, 2006 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] Quote Link to comment Share on other sites More sharing options...
obsidian Posted September 30, 2006 Share Posted September 30, 2006 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 Link to comment Share on other sites More sharing options...
caffeblog Posted September 30, 2006 Author Share Posted September 30, 2006 [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] Quote Link to comment Share on other sites More sharing options...
obsidian Posted September 30, 2006 Share Posted September 30, 2006 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 Link to comment Share on other sites More sharing options...
caffeblog Posted September 30, 2006 Author Share Posted September 30, 2006 [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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.