Jump to content

[SOLVED] DISTINCT not working


vince164

Recommended Posts

hi thanks for the reply, well its still getting duplicates and no the id is not unique, although i did manage to get it to work with only using 1 table if i pull the information from 1 table instead of 2 it will work but is there a way to pull the data from 2 tables and still have it show unique stuff i will include my  code

 

mysql tables

link, link_img

 

mysql table link_img fields

id

 

mysql link_img table fields

name

 

here is my full php code

 

$q = "SELECT DISTINCT id,name FROM links,link_img WHERE `active`='Yes' AND `in`>'0' ORDER BY RAND() LIMIT 0, 6";

$games = get_games("shortdesc=".$themecfg['maxdesclength']."&htmlize=true&diffquery=".$q);

foreach ($games as $game) {

{
?>


<?php

  echo "<div class='midpbtnin'>
                    <a href='".get_home_link()."links/out/".("".$game['id']).".html' target='_blank'><img src='[themedir]layout/images/100x110/".$game['name']."-up.gif' onmouseover=this.src='[themedir]layout/images/100x110/".$game['name']."-down.gif'; onmouseout=this.src='[themedir]layout/images/100x110/".$game['name']."-up.gif'; alt='".$game['title']."' width='100' height='100'  /></a>
                    </div>";
?>
<?php
}

}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.