dbradbury Posted January 28, 2010 Share Posted January 28, 2010 how do you select the first row in phpmyadmin... i have these dates in a table, well wach date is a topic, and i would like to choose just the first date, the earliest one, well the one that will happen next... include("//connect.php"); mysql_query("SELECT * FROM phpbb_posts WHERE forum_id='10' ORDER BY post_subject ASC"); is that the starting point? would i select all, * ? Link to comment https://forums.phpfreaks.com/topic/190135-im-not-sure-about-this-but/ Share on other sites More sharing options...
dbradbury Posted January 28, 2010 Author Share Posted January 28, 2010 nevermind, got it Link to comment https://forums.phpfreaks.com/topic/190135-im-not-sure-about-this-but/#findComment-1003201 Share on other sites More sharing options...
jskywalker Posted January 28, 2010 Share Posted January 28, 2010 was it something like: SELECT `date` FROM phpbb_posts WHERE forum_id='10' and `date`>now() ORDER BY `date` ASC LIMIT 1; ? Link to comment https://forums.phpfreaks.com/topic/190135-im-not-sure-about-this-but/#findComment-1003205 Share on other sites More sharing options...
dbradbury Posted January 28, 2010 Author Share Posted January 28, 2010 yeah lol my code is this.. <? include("connect.php"); $getalldates = mysql_query("SELECT * FROM phpbb_posts WHERE forum_id='9' ORDER BY post_subject ASC LIMIT 1"); $count = mysql_num_rows($getalldates); if($count==0) { echo "No Concerts At The Moment!"; } else { while($row = mysql_fetch_assoc($getalldates)) { $date = date('l F jS', strtotime($row['post_subject'])); echo '<marquee>Next Concert is '.$date.' at '.$row['post_text'].'</marquee>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/190135-im-not-sure-about-this-but/#findComment-1003206 Share on other sites More sharing options...
jskywalker Posted January 30, 2010 Share Posted January 30, 2010 because in your SQL statement is "ORDER BY post_subject " you will get the next concert for "ABBA", and not the one for "ZZ-top" Link to comment https://forums.phpfreaks.com/topic/190135-im-not-sure-about-this-but/#findComment-1004147 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.