How can I prevent repeating information... [solved]
Posted: Mon Apr 17, 2006 8:55 am
Hello,
I'm working on a PHP/mySQL-dependent website that allows visitors to upload their animations for the public.
What I'm trying to do is have a list, from the database, of all the submitters, e.g.
Choose an Animator
Joe
Alex
Mike
The most straightforward way to do this is:
This simple script displays all the names of all the submitters. The only problem is, if Alex submitted three animations, I don't want the script to display his name three times - I just want it once.
So I tried adding this:
I know that's probably completely wrong, but I was hoping that, in some warped way, it would detect whether I had already displayed the name. I was wrong, of course.
So, now that I've spent 5 minutes leading up to a really dumb question...how can I just display the person's name once, without any repeats?
I'm working on a PHP/mySQL-dependent website that allows visitors to upload their animations for the public.
What I'm trying to do is have a list, from the database, of all the submitters, e.g.
Choose an Animator
Joe
Alex
Mike
The most straightforward way to do this is:
Code: Select all
$sql = "SELECT creator FROM animations";
$result = @mysql_query($sql, $connection);
while ($row = mysql_fetch_array($result)) {
echo $row['animator'];
}So I tried adding this:
Code: Select all
while ($row = mysql_fetch_array($result)) {
if (!eregi($row['animator'], $row) {
echo $row['animator'];
}
}So, now that I've spent 5 minutes leading up to a really dumb question...how can I just display the person's name once, without any repeats?