Jump to content

Archived

This topic is now archived and is closed to further replies.

jetpackmac

Display MySQL entries within a certain timeframe?

Recommended Posts

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.