Showing rows posted less than X days ago
Posted: Mon Jul 29, 2013 4:24 am
I'm showing some row from a table and I want only to show rows from 3 days ago or less.
But no luck so far
But no luck so far
Code: Select all
<?php
$i=1;
$query = "SELECT id FROM announceaments ORDER BY id DESC LIMIT 0,1";
$result = mysql_query($query) or die(mysql_error());
$grab = mysql_fetch_assoc($result);
$id = $grab['id'];
echo "<div class=\"BoxesWithOuterShadows\">";
if($id==0)
echo "There is no announceaments to show.";
else
while($i<=5)
{
$announceinfo="SELECT * FROM announceaments WHERE id='$id'";
$announceinfo2=mysql_query($announceinfo) or die("could not get account stats!");
$announceinfo3=mysql_fetch_array($announceinfo2);
$title=$announceinfo3['announcetitle'];
$text=$announceinfo3['announceament'];
$time=$announceinfo3['entrydate'];
$date=$announceinfo3['date'];
$title=nl2br($title);
$text=nl2br($text);
$time=nl2br($time);
$3days=date("Y-m-d");
if( strtotime($database_date) > strtotime($3days) && strtotime($database_date) < strtotime('now') )
$test='yes';
else
$test='no';
if(isset($title)&&$id>0&&$test=='yes')
{