Hey guys, I am working on a chatter of the day code so i have created a new database table which inserts 1 point for every chat message sent, it comprises of the uid, timesent, and the credit rows. I've managed to show how many points the top 20 members earn in total, but it doesn't restart like after 24 hours I would like for all the points disappear after 24 hours and restart, or atleast to show the top 20 members within 24 hours only, but it remains the same and keep adding up this is my code can anyone assist please?
else if($action=="mdde")
{
addonline(getuid_sid($sid),"Viewing chatter of the day","");
echo head("Chatter of day","", getuid_sid($sid));
echo "<p align="center">";
echo "Top 10 Members for the day";
echo "</p>";
//////ALL LISTS SCRIPT <<
$oneday = time() - (24*60*60);
//changable sql
$sql = "SELECT COUNT(credit), uid FROM ibwf_updateday WHERE timesent>'".mysql_real_escape_string($oneday)."' GROUP BY uid ORDER BY COUNT(credit) DESC LIMIT 20";
$items = mysql_query($sql);
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$unick = getnick_uid($item[1]);
echo "<div align="left">";
$lnk = "»<a href="index.php?action=viewuser&who=$item[1]&sid=$sid">".htmlspecialchars($unick)."</a> credits: $item[0]";
echo "$lnk<br/>";
echo "</div>";
}
} else {
echo "No member of the day right now";
}
echo "</p>";
////// UNTILL HERE >>
exit();
}
else if($action=="mdde")
{
addonline(getuid_sid($sid),"Viewing chatter of the day","");
echo head("Chatter of day","", getuid_sid($sid));
echo "<p align="center">";
echo "Top 10 Members for the day";
echo "</p>";
//////ALL LISTS SCRIPT <<
$oneday = time() - (24*60*60);
//changable sql
$sql = "SELECT COUNT(credit), uid FROM ibwf_updateday WHERE timesent>'".mysql_real_escape_string($oneday)."' GROUP BY uid ORDER BY COUNT(credit) DESC LIMIT 20";
$items = mysql_query($sql);
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$unick = getnick_uid($item[1]);
echo "<div align="left">";
$lnk = "»<a href="index.php?action=viewuser&who=$item[1]&sid=$sid">".htmlspecialchars($unick)."</a> credits: $item[0]";
echo "$lnk<br/>";
echo "</div>";
}
} else {
echo "No member of the day right now";
}
echo "</p>";
////// UNTILL HERE >>
exit();
}
Comment