Make each row display only once?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
elinews
Forum Commoner
Posts: 38
Joined: Tue Aug 14, 2007 7:18 pm

Make each row display only once?

Post by elinews »

This is what I'm using to display the pages updated within a week for a website:

Code: Select all

if ($last_edit > date("Y-m-d", strtotime ("-8 days"))) echo "<a href='http://www.website.org/php/$page_name.php'>$page_name</a> -- $last_edit<br>"; else echo "";
Only thing is I want to make it so that $page_name will not repeat itself if it's already listed. How do I go about doing this?

Hope I described my problem well enough.

Thanks!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Is last edit coming from a database? If so, you could use the GROUP BY clause. Or, store all filenames in an array, and use array_unique() on the array.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
elinews
Forum Commoner
Posts: 38
Joined: Tue Aug 14, 2007 7:18 pm

Post by elinews »

Oh. What a simple solution. Thanks scott.
Post Reply