PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
And in the right there should be three of the upcoming events, starting with the next event. But my code below, is acting unexpected. When I set the "LIMIT" to 3, it shows nothing, but when I set it to six, it shows three. I'm confused. Can someone help?
Is it possible that you have some old events that are showing up first in your list and then the if-then for checking the time doesn't display them? Remember the time is the server's time, where ever that is. I think you'd have to post some of your data if you want more specific help. Perhaps just bypass the if-then inside your while statement and see if that is the problem.
Hey Eric,
Thanks for the reply, though I'm not sure how that helps me to understand why it shows the wrong number of posts when I set the "LIMIT" to 3? Can you explain a little for me? Thanks!
You said there is nothing when you set the limit to 3, that is probably because either the query doesn't return something or the if-then inside your while is preventing it from printing. Without seeing your data I can't narrow it down any further.
When you set it to 6 it is probably returning 6 but your if-then is filtering out 3 of them...probably the first there that were also filtered out when you had the limit set to 3 in the first case.
(note, I edited the previous response with some info on MySQL date sorting)
Now I'm still getting an unusual issue with the the items not appearing in correct chronological order. It should go upcoming event first descending to events further in the future. I think it has something to do with recurring events taking priority, because if I change "ASC" to "DESC" it puts things in the right chronological order backwards.
would i be right in assuming that you want to display the events in ascending order, but limit to the 3 rows at the end (to show the closest date first)
you would need to set your limit in your query to account for this.
Yeah, that's what I'm trying to accomplish. So I replace my query string with yours, and I get a syntax error. I'm not familiar with this technique can you explain a bit what's going on?
Parse error: syntax error, unexpected '"' in /home/d363f86b/public_html/west-valley-community-church/wp-content/themes/west-valley-community-church/index.php on line 66