Jump to content

Limit mysql array information if same text is twice in a row


shortysbest

Recommended Posts

I have a notification type of thing going on with when the admin of the website changes information on so and so pages it shows "___page___ has been updated on ___date___." And right now what happens is if you update the same section twice or more it just spams the same update taking all 11 spots (limit i set for notification area) and just doesnt look very good either, pointless to do this. I would like for it to only show that update once.

Right now:

 

About Us has been updated. May 30, 2010

About Us has been updated. May 28, 2010

About Us has been updated. May 27, 2010

About Us has been updated. May 23, 2010

About Us has been updated. May 11, 2010

New Dealer Information has been updated. May 7, 2010

 

 

What i want:

 

About Us has been updated. May 30, 2010

New Dealer Information has been updated. May 7, 2010

 

This is my current php code for where the array of information is being displayed:

 

<?php
$query2 = mysql_query("SELECT * FROM notification ORDER BY id DESC LIMIT 11");
while ($row2 = mysql_fetch_array($query2))
{
Print "<div class='updatebox'><a class='update' href='".$row2['url']."'><div class='update'>".$row2['update']."</div></a> has been updated.<div class='updated'>".date('M d, Y', strtotime($row2['date']))."</div></div>";
}
?>

 

Thanks.

Archived

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

×
×
  • 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.