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
}

}

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.