For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > December 2005 > Need a Help!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Need a Help!
Mohamed Yusuf

2005-12-12, 6:59 pm

I have table and insert data using song_id, that means one artist can have
many song_ids. my question is how can I query distinct artist with his/her
song_id while I will not get duplicate data like duplicate artist?
my code is like this

$content .="<form id=\"form1\" method=\"post\" action=\"\">
<select name=\"Quick\" onchange=\"MM_jumpMenu('parent',this,0)\">
<option value=\"#\">Select Artist</option>";


$result= $db->sql_query("SELECT distinct(artist), id FROM
".$prefix."_lyrics order by artist asc");
if ($db->sql_numrows($result)) {
while($row = $db->sql_fetchrow($result)) {
extract($row);
$content .="<option value='modules.php
?name=$module_name&file=artist&c_id=$id'>$artist</option>";
}
}

$content .="</select>
</form>";

that code is fine except it gives me duplicate artist, so I want get rid off
that duplicate. any help

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com