Jump to content


Photo

Display MySQL entries within a certain timeframe?


  • Please log in to reply
No replies to this topic

#1 jetpackmac

jetpackmac
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 June 2006 - 08:09 PM

Hi Everyone!

I have a page where I'm using PHP to include some entries from a MySQL db. All the entries have a date field and I'm using the date field to display them in ascending order.

What i'm trying to figure out is, how to display the MySQL entries starting from the current date to about 3 or 4 months in the future. All the other entries in the database wouldn't be displayed...

Here's some code:

[!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--]---------------- Calling the database----------------

<?php require_once('../Connections/GetFestDir.php'); ?>

<?php
mysql_select_db($database_GetFestDir, $GetFestDir);
$query_GetFestDead = "SELECT *, DATE_FORMAT(deadline,'%b/%d') AS newDead FROM festdir ORDER BY `feststart` ASC";
$GetFestDead = mysql_query($query_GetFestDead, $GetFestDir) or die(mysql_error());
$row_GetFestDead = mysql_fetch_assoc($GetFestDead);
$totalRows_GetFestDead = mysql_num_rows($GetFestDead);
?>

---------------- Displaying the Entries ---------------

<div style="width: 140px; height: 260px; overflow: auto">
<table width="120" align="left">
<?php do { ?>
<tr>
<td><h2 align="left"><strong><?php echo $row_GetFestDead['newDead']; ?></strong><br>
<a href="<?php echo $row_GetFestDead['link']; ?>" class="orange" target="_blank"><?php echo $row_GetFestDead['name']; ?></a>
</h2></td>
</tr>
<?php } while ($row_GetFestDead = mysql_fetch_assoc($GetFestDead)); ?>
</table>
</div>

--------------------------------------------------------[!--colorc--][/span][!--/colorc--]

Any thoughts?

Thanks a ton!

-JPM





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users