Wells-it.com - Web Hosting

Limiting the number of times displayed

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
sublimer's picture

They have: 41 posts

Joined: Aug 2006

For what im talking about please visit...

http://www.sublimestylee.com/pages/videos_artist.php

I had a solution to my problem on a different website I made but I cant log in to retrieve the code, it was pretty simple.

As you can see on that page it displays pepper twice and slightly stoopid many times. Thats because I have 2 pepper videos and several slightly stoopid videos. I only want it to be represented one time. That page should only show Pepper and then Slightly Stoopid on a seperate line.

Thanks
-drew

wwwDOTcom Solutions

Greg K's picture
Moderator

He has: 1,652 posts

Joined: Nov 2003

There was an error is your SQL statemtent when I visited the page, so I couldn't see what you were talking about, however, if I am understanding you correctly, what you are wanting in the DISTINCT option to select only unique entries (remove duplicates).

Just guessing based on the error I'm given on your page, you would want something similar to this:SELECT DISTINCT `artist` FROM `downloads` WHERE `filetype`='video' ORDER BY `artist`'See http://dev.mysql.com/doc/refman/5.0/en/select.html for more info.

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

sublimer's picture

They have: 41 posts

Joined: Aug 2006

thanks, i had my punction wrong. i remeber needing to inlcude DISTINCT.

this is what i had before your correction!

$sql = "SELECT DISTINCT 'artist' * FROM downloads WHERE filetype='video' ORDER BY artist ASC";

thanks alot Greg K
-drew

wwwDOTcom Solutions

timjpriebe's picture
DeveloperModeratorSponsor

He has: 2,666 posts

Joined: Dec 2004

You need to delete the *. That won't really even logically work with the distinct statement, but if you really want to display any other fields, you'll have to list them out specifically.