LifeinAsia

msg:4055985 | 4:37 pm on Jan 7, 2010 (gmt 0) |
If you're not going to display the stories, then why don't you just exclude them from the query in the first place?
|
chasehx

msg:4056002 | 5:04 pm on Jan 7, 2010 (gmt 0) |
The thing is, the script has to pull the value for the activated field to know it is not supposed to show it. I think you may have given me some inspiration though. I am going to before executing the main query, execute one to check for hidden stories on that page. For every hidden story it finds, by way of the 'activated' field switch, I will have it +1 to the limit of the query. Does someone want to tell me if there is a more efficient way, or is that about how I should go?
|
whoisgregg

msg:4056018 | 5:25 pm on Jan 7, 2010 (gmt 0) |
There shouldn't be any reason why you need to have PHP skip the unactivated posts. MySQL can do it in the query before it even gets to PHP: SELECT * FROM `article` WHERE `activated` = 1 |
|
|
chasehx

msg:4056020 | 5:30 pm on Jan 7, 2010 (gmt 0) |
Ah duh! Hahaha this is my third year of PHP and sometimes my mind starts thinking way complicated instead of simple. Wow, thanks guys. Sorry about that I feel like a dunce!
|
whoisgregg

msg:4056031 | 5:45 pm on Jan 7, 2010 (gmt 0) |
No worries. :) I used to do all sorts of manipulation of MySQL data in PHP code. But one of the early things I learned on WebmasterWorld that I always remember is "MySQL is a database engine, PHP isn't." You should always try to push anything to do with slicing, dicing, or sorting data to MySQL.
|
chasehx

msg:4056235 | 9:43 pm on Jan 7, 2010 (gmt 0) |
That is good advice, i'll keep that in mind. Thank you so much for your help.
|
|