![]() |
Algorithm help and logic struction questions.
I'm trying to setup an automated Member of the Week section on my home page using Velocd's Member photo hack, and have it all customized the way I want, except for the algorigthm and logic structure to rotate the member each week.
If you're not familiar with the hack, it creates a table that contains the photo info for members that have uploaded their images. I want the logic to be able to pull a new member for display each week, and not repeat until all members have been displayed once. Also, it needs to be able to pull only from members that have submitted their photo. Any ideas? I'm slightly burnt out on coding right now, so my brain could use a little jogging on the best way to approach this with minimal queries and performance impact. Thanks in advance! |
Maybe you should add a new column that holds either 0 or 1, for letting the script know if that member has already been shown once already?
Some pseudo code to help you along (the extra column that I suggest will be named chosen here): Code:
search for a random member in table tbl_name |
Thanks Gary! I did some brain storming this evening, after a much needed break from coding (kinda sux sometimes when you have a large web dev team, and you're the only one that fully understands PHP, vb, MySQL, and how it ALL goes together)
Anyway, here's my VERY rough draft of the snippet of code that I *think* will work It will require adding 2 new fields: displayweek and displayed. Display week will hold the INT of the week that member was/is displayed, and the displayed feild will be a -1,0,1 flag. 0 for not being displayed yet, 1 for being previously displayed, and -1 for being currently displayed. Oh, and FYI, MOTW stands for Member of the week (just my little coding abbreviation ;) Feel free to pick it apart (aside from syntax... I know it's not right) conceptually and let me know what you all think: PHP Code:
|
You're missing a " for
PHP Code:
PHP Code:
PHP Code:
|
Thanks for the feedback! Here's what I've currently got up and running, and it seems to run quite well. The only downside is that the FIRST person to view this page at the beginning of the week (Monday 12:01 AM) will have a few extra queries (6 total) in their page load, but other than that, it only adds one query on a regular basis.
PHP Code:
|
All times are GMT. The time now is 01:42 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|