Msg#: 4055972 posted 4:27 pm on Jan 7, 2010 (gmt 0)
I have a custom news blog I set up for where I work but I am having a problem. I have a field for each news article entry in the database called 'activated'. The value is either 0 or 1, for on or off of course. The problem is, i have the db set to spit out three stories a page. The page though that the hidden story would appear on were it not to be skipped by a 'continue' statement in the while($row) loop. I am trying to figure out how to get my query to see these results and not count them in the three articles that will actually be on the page. I am stumped guys. Anyone have a little insight?
Msg#: 4055972 posted 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?
Msg#: 4055972 posted 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.