Page 1 of 1

Make each row display only once?

Posted: Sun Sep 02, 2007 4:16 pm
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!

Posted: Sun Sep 02, 2007 11:55 pm
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.

Posted: Mon Sep 03, 2007 10:33 am
by elinews
Oh. What a simple solution. Thanks scott.