Jump to content

Display MySQL entries within a certain timeframe?


jetpackmac

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.