Ok I've changed it to DATE format so the date's are listed as 2006-03-23 but I'm still insure as to how to get all the records with a date in the future. What I have now is
PHP Code:
$now = date("Y-m-d");
$result = mysql_query("SELECT * FROM gigs WHERE gig_date > $now order by gig_date ASC ");
the whole code is below
(edited)
PHP Code:
<?php
include( "pagehead.php" );
include( "misc.inc" );
$result = mysql_query("SELECT * FROM gigs WHERE gig_date > NOW() order by gig_date ASC ");
?>
<div class="content">
<h1>Gigs listing</h1>
<h2>Upcoming gigs</h2>
<?php
while ($row = mysql_fetch_assoc($result)) {
$date = $row["gig_date"];
$date = date("d/m/Y", $date);
$location = $row["gig_location"];
$info = $row["gig_description"];
echo "<p>$date<br />$location<br />$info</p>";
}
?>
</div>
<div class="content">
<h2>Previous gigs</h2>
<?php
$result2 = mysql_query("SELECT * FROM gigs WHERE gig_date < NOW() order by gig_date ASC ");
while ($row2 = mysql_fetch_assoc($result2)) {
$date2 = $row2["gig_date"];
$date2 = date("d/m/Y", $date2);
$location2 = $row2["gig_location"];
$info2 = $row2["gig_description"];
echo "<p>$date2<br />$location2<br />$info2</p>";
}
?>
<p>The band can't remember dates, but you may have seen them at one of these many venues they've played.</p>
<hr />
<p class="gig">Droothy Neebors - Dundee</p>
<p class="gig">The New Westport Bar - Dundee</p>
<p class="gig">The Beat Bar - Dundee</p>
<p class="gig">The Rothes Halls - Glenrothes</p>
<p class="gig">The Subway - Edinburgh</p>
<p class="gig">The Path Tavern - Kirkcaldy</p>
</div>
</body>
</html>
Bookmarks