how to make mysql display one of each value
Posted: Sat Oct 08, 2005 10:15 pm
If an array has duplicate values (a, a, b, b, b, c, d, d) is there any way to make it only have one of each? (a, b, c, d). Thanks!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$title_xbox = mysql_query("select distinct title from review where subsystem='xbox'");
$num_xbox=mysql_numrows($title_xbox);
echo "<h4>Xbox:</h4>";
while($r=mysql_fetch_array($title_xbox))
{
echo "<a href=\"reviews.php?cmd=view&title=$title_xbox\">$title_xbox</a><br>";
}
if ($num_xbox == 0) {
echo "No Xbox Reviews Found<br><br>";
}Code: Select all
echo "<a href=\"reviews.php?cmd=view&title={$r['title']}\">{$r['title']}</a><br>";Code: Select all
$exact_results = mysql_query("select distinct title from review where title='$title' and subsystem='$subsystem'");
while($r=mysql_fetch_array($exact_results))
{
$e_title = $r["title"];
$e_subsystem = $r["subsystem"];
echo "<tr><td><a href=\"index.php?id=submit&cmd=form&title=$e_title&subsystem=$e_subsystem\">$e_title</a></td><td>$e_subsystem</td></tr>";
}Code: Select all
select distinct title, subsystem from review where subsystem='xbox'