evhwanabe Posted July 28, 2005 Posted July 28, 2005 I have a website that is about live local music. fingerlakeslive Right now I am using phpbb with the mycalendar addon to take care of users inputting upcoming shows. What I am trying to do is make an index page see here that pulls these events out and displays them on a side bar. I have made some progress, but have one question about my select query. current select query >$result = @mysql_query('SELECT * FROM phpbb_mycalendar,phpbb_topics WHERE phpbb_mycalendar.topic_id=phpbb_topics.topic_id ORDER BY cal_date LIMIT 10'); This works and displays what you see on my index page. But you will notice that it is displaying events that have already happened. How do I select only upcoming dates? do I use CURDATE() somehow in my query? I am somewhat new to php/mysql so take it easy on me. lol thanks Quote
TCH-Thomas Posted July 28, 2005 Posted July 28, 2005 Sorry, I don´t know the answer to this but... Welcome to the forum. Quote
evhwanabe Posted July 28, 2005 Author Posted July 28, 2005 Sorry, I don´t know the answer to this but... Welcome to the forum. <{POST_SNAPBACK}> lol well atleast your honest! and thanks for the welcoming! I have been with TCH for quite some time now, and I can't believe I have never used these forums. Quote
borfast Posted July 28, 2005 Posted July 28, 2005 evhwanabe, try using this query: $result = @mysql_query("SELECT * FROM phpbb_mycalendar,phpbb_topics WHERE phpbb_mycalendar.topic_id=phpbb_topics.topic_id AND phpbb_mycalendar.date>='".time()."' ORDER BY cal_date LIMIT 10"); Quote
evhwanabe Posted July 28, 2005 Author Posted July 28, 2005 evhwanabe, try using this query: $result = @mysql_query("SELECT * FROM phpbb_mycalendar,phpbb_topics WHERE phpbb_mycalendar.topic_id=phpbb_topics.topic_id AND phpbb_mycalendar.date>='".time()."' ORDER BY cal_date LIMIT 10"); <{POST_SNAPBACK}> hmmmm still no luck. the date field (timestamp) I am trying to go by is stored in the phpbb_mycalendar table in row cal_date I changed your above code "phpbb_mycalendar.date" to "phpbb_mycalendar.cal_date" and still no luck. thanks for the reply Quote
evhwanabe Posted July 28, 2005 Author Posted July 28, 2005 Got it! >$result = @mysql_query("SELECT * FROM phpbb_mycalendar,phpbb_topics WHERE phpbb_mycalendar.topic_id=phpbb_topics.topic_id AND phpbb_mycalendar.cal_date>=CURDATE() ORDER BY cal_date LIMIT 10"); Thanks guys! Quote
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.