I have a premium ads script with a classified ads site.
I show all premium ads on the front page & category pages ordered randemly.
I would like to limit the premium ads in the category pages to their categories. Can anyone look @ this script & give some advice?
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="584" height="1">
<tr>
<td width="584" height="19" background="images/bg2.gif">
<p align="center"><font color="#FFFFFF"><b>PREMIUM ADS</b></font></td>
</tr>
<tr>
<td width="584" height="19">
<font color="#FFFFFF"><b> </b></font></td>
</tr>
<tr>
<td width="584" height="119"><table width="100%" height="61" border="0" cellspacing="0">
<tr>
<td height="21"><div align="center"> </div></td>
<?
require("admin/inc.php");
// Sql statement to get the ads that are special ordered randomly.
$sql_siste = "select sitetitle, siteid from $ads_tbl where is_special = 1 order by rand() limit 5 ";
$sql_siste_result = mysql_query ($sql_siste);
$num_links = mysql_num_rows($sql_siste_result);
// This for statement is used to show those 5 ads that we had limited to.
for ($i=0; $i<$num_links; $i++)
{
$row = mysql_fetch_array($sql_siste_result);
$sitetitle1_siste = $row["sitetitle"];
$siteid = $row["siteid"];
$kid = $row["kid"];
// Sql statement to get the image while i am still getting new rows, stillkeeping the
// link between the ad and the image.
$img = "select * from $pic_tbl where pictures_siteid = $siteid";
$result_sq = mysql_query($img);
$realimg = mysql_fetch_array($result_sq);
$image = $realimg["filename"];
$sitetitle1_toshow = substr($sitetitle1_siste, 0, 20);
if ($image) {print("<center><td><center><a href='detail.php?siteid=$siteid'><img src='images/$image' width='87' height='87' border='2'></center><br></center>");}
else {print("<td><center><a href='detail.php?siteid=$siteid'>
<img src='layout_images/noimage_100.gif' width='48' height='43' border='2'></center><br>");}
print("<center><b>$sitetitle1_toshow</b></center></a>");}
?></td>
</tr>
</table>
</center>
</div>
<br>
<br>
<tr>
<td width="584" height="1"><b>