Page 1 of 1

[56k Warn] "SELECT DISTINCT" and the "NOT LIKE"

Posted: Sat May 16, 2009 10:09 am
by randall
Been battling this, I think the "SELECT DISTINCT" and the "NOT LIKE" statements are conflicting... I think...

Code: Select all

 
<?php include "inc/connect.php" ?>
<?php
$nav = mysql_query("SELECT DISTINCT a_cat.category_name
FROM a_cat 
WHERE a_cat.catStatus=1 
AND `fileName` NOT LIKE CONVERT( _utf8  'NEW-PRODUCTS, 0%' USING latin1 ) COLLATE latin1_swedish_ci");
?>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr> 
<td><table width="100%"  cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        
<tr>
          <td width="2"><img src="images/spacer.gif" width="1" height="12" /></td>
          </tr>
        <tr>
          <td align="center" valign="middle"><table width="100%" height="1" border="0" cellspacing="0" cellpadding="0">
 
<?php
while ($data = mysql_fetch_array($nav))
{ ?>
            <tr> 
              <td align="center" valign="middle"><img src="images/diamond.png" width="11" height="13" /></td>
            <td>&nbsp;</td>
            <td align="left"><a STYLE="text-decoration:none" href="categories.php?catid=<?=$data["subCatID"]?>"><font color="#393833" size="2" face="Verdana, Arial, Helvetica, sans-serif"><?=$data["catName"]?></font></a></td>
          </tr>
            <tr> 
              <?
}
?>
              </table><?php end ?></td>
          </tr>
        <tr> 
          <td><img src="images/spacer.gif" width="1" height="12" /></td>
          </tr>
      </table>
</td>
</tr>
</table>
<?php end ?>
<br>
 
 

Image

Re: [56k Warn] "SELECT DISTINCT" and the "NOT LIKE"

Posted: Sat May 16, 2009 12:54 pm
by Mark Baker
You're not saying what the problem is but

Code: Select all

SELECT DISTINCT a_cat.category_name
should be

Code: Select all

SELECT DISTINCT a_cat.catName
based on your database table images

Though is it supposed to return any records?

Re: [56k Warn] "SELECT DISTINCT" and the "NOT LIKE"

Posted: Sat May 16, 2009 2:29 pm
by randall
Thx, :crazy: