Granny Annie Posted July 22, 2009 Share Posted July 22, 2009 The script below references a data base with shows from 2008 and 2009. It selects the next four sequential dates to list, but ignores the year. So I have shows from 2008 included. Suggestion? <?php $cur = date("m/d/y"); mysql_select_db("shows", $con); $s = mysql_query("SELECT * FROM live WHERE date >= '$cur' ORDER BY date LIMIT 0, 4"); while($r = mysql_fetch_array($s)) { echo $r['date'] . " <br> " . $r['place'] . " <br> " . $r['time']; echo "<br />"; echo "<br />"; Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 22, 2009 Share Posted July 22, 2009 "m/d/y" Is your date field in that same format? If so, you cannot do any comparisons or sorting using that format because the fields that make it up are not ordered from MSD (most significant digit - Y) to LSD (least significant digit - d). If you want to do date comparisons or ordering by dates the format must be YYYY-MM-DD (with leading zeros), which is why the DATE data type exists. Quote Link to comment Share on other sites More sharing options...
Granny Annie Posted July 23, 2009 Author Share Posted July 23, 2009 I'm way new at this and have taken over a band website after the designer skipped town. I understand what you are saying, but where do I find the date field? Is this where I enter the show dates to begin with? I have a pull down list for Month/Day/Year. I want shows to list with the month first, then day, then year. I'll try to find the code and copy it into a message. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 23, 2009 Share Posted July 23, 2009 The code is doing - echo $r['date'] What does that show for values? Quote Link to comment Share on other sites More sharing options...
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.