I am lost. I have tried everything I can think of, maybe someone else can see what I am doing wrong. I keep getting this error: Not unique table/alias: 'sitecategories'
tables look like this:
sites:
id
site_address
site_name
publish (Y or N)
site_image
sitecategories:
id
category_name
siteincat:
catid
siteid
There are no other tables.
My first page of code:
<a href="portfolio2.php?$cat=auction">auction</A>
<a href="portfolio2.php?$cat=auto">auto</A>
<a href="portfolio2.php?$cat=construction">construction</A>
<a href="portfolio2.php?$cat=dating">dating</A>
<a href="portfolio2.php?$cat=database">database</A>
Results page:
<?
if(!IsSet($start))
$start = 0;
$result=mysql_query("SELECT site_name, site_address, site_image, publish, sites.id, sitecategories.id, category_name from sites,sitecategories LEFT JOIN siteincat ON sites.id=siteid LEFT JOIN sitecategories ON siteincat.catid=sitecategories.id WHERE sitecategories.category_name='$cat' AND publish = 'Y' ORDER BY site_name ASC") or die(mysql_error());?>
<table width="100%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<?
while($row = mysql_fetch_object($result))
{
echo '<td width="25%" align="center" valign="top"><a href= "',$row->site_address,'" target="blank"><img src="samples/',$row->site_image,'"width="100" height="75" border="0"></a><br><a href= "',$row->site_address,'" target="blank">',$row->site_name,'</a></td>';
if(++$i % 4 == 0)
echo '</tr><tr>';
}
?>
</table>