in the sql question bellow, how can i make it so the output dont show doubles ? like if the output is "tag,tag1,tag2,tag1" the second tag1 is removed so it's only shown once ? <?php $sql = "select distinct tags from images"; $rs = mysql_query($sql); while($row=@mysql_fetch_object($rs)){ print "<a href=http://site.com/tags.php?tag=$row->tags> $row->tags</a> <br> "; } ?> PHP:
hmmmm try $sql = "SELECT *.* FROM images WHERE name = distinct tags"; if thats how your table's built....
Hi, What is the problem using this code, select distinct(tags) from images; if you are not getting the result correctly, explain in detail Soman
didint work :/ the problem is that my output is someting like this and i dont want doubles anywhere :/ Alison,Celebrity Pyle,Celebrity Kate,Celebrity
Hi, You can not use Distinct keyword for these type of values in the Fiedls. You have to use PHP code to achive this try the following code, i hope it will help you $full_string = ''; $sql = "select tags from images"; $rs = mysql_query($sql); while($row=@mysql_fetch_object($rs)) { $full_string . = $row->tags; $full_string . = ','; } $full_array = explode(',', $full_string); $unique_array = array_unique($full_array); Soman
thanks for your response. im getting a "Parse error: syntax error, unexpected '=' " for this line *$full_string . = $row->tags;* :/