This is a discussion on "Returning results into a table with no repeat of data" within the PHP Forum section. This forum, and the thread "Returning results into a table with no repeat of data are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Returning results into a table with no repeat of data
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Returning results into a table with no repeat of data
Hi guys, i got another prob with a diff script of mine...
The user can click a letter of the alphabet and all the artists beginning with that letter will be shown. But my problem is if the user has say 5 songs in the db then the artist name will appear 5 times. Below is the script which i currently have which does this:
Many thanks Lobster |
|
|
|
|||
|
In the mysql query put:
LIMIT 1 at the end. |
|
|||
|
If i do that it only shows one artist all together. I want it to show many artists but only 1 of each.
Here is an example of my problem...say i got 3 songs by james smith and 3 songs by james black... i get Artist || James Smith James Smith James Smith James Black James Black James Black But any of the James Smith's when clicked will give the same page.. So i just want Artist || James Smith James Black Any ideas on how to do this? Thanks lobster |
|
|||
|
In your sql sort by artist
then in your loop if($lastartist != $thisartist) echo $thisartist; if that doesn't make sence, say so, and i'll give you more details. |
|
|||
|
I understand the IF statement, but im not sure where it goes in the code
Thanks Lobster |
|
||||
|
could you not just add "GROUP BY artistname" to the end of the SQL query string?
|
|
|||
|
Ben you done it again! Thankyou!! arghhhhh that problem has been bugging me for the last 2 days!! Thanks!!!!!! Problem solved!
lobster :P |
![]() |
| Tags |
| returning, results, table, repeat, data |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Repeat data entered in a text box... and maybe change it? | simbo1231 | JavaScript Forum | 4 | Dec 2nd, 2007 10:24 |
| how access data from table in php, | azeemserver | PHP Forum | 2 | Aug 30th, 2007 11:09 |
| Returning ajax data | kenoli | JavaScript Forum | 1 | Aug 21st, 2007 11:27 |
| background-repeat: repeat y not working properly | AdRock | Web Page Design | 12 | Feb 25th, 2007 22:17 |
| Problem returning results into table | lobster1983 | PHP Forum | 2 | Sep 15th, 2005 21:40 |