second set of categories problem php

by Wags
6 replies
i have created a second set of cats, for my website but when i click one of the categories it results in showing all listings and not the selected category listings

<?
require_once('config/config.php');
$where="";
if($_REQUEST['site_status_name']!="")
{
$where.=" AND site_status_name='".$_REQUEST['site_status_name']."'";
}
if($_REQUEST['keytxt']!="")
{
$where.=" AND (price like '%".escapeQuotes(stripslashes($_REQUEST['keytxt']))."%' OR title like '%".escapeQuotes(stripslashes($_REQUEST['keytxt']))."%')";
//echo $where;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?=TITLE?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="<?=META_KEYWORDS?>"/>
<meta name="description" content="<?=META_CONTENT?>"/>
<link href="css/fresh-auction.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function jsHitListAction(p1)
{
document.frm.action = "<?=$_SERVER['PHP_SELF']?>?PageNo=" + eval(p1) ;
document.frm.submit()
}
</script>
</head>
<? include_once("toppage1.php");?>
<body>
<div id="container" >
<div id="contentwrapper" >
<? include_once("left-menu.php");?>
<div id="content" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>

<div class="header_top">
<? include_once("cart-info.php");?>
</div>


<div class="clear"></div>


<!--div class="menu_top">
<? include_once("top-menu.php")?>
</div-->
<p><span class="header_text_h">Search All Listings!</span></p>
<p align="left">
<form name="frm" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="border">
<tr>
<td width="39%" class="rowhead" align="left">Title</td>
<td width="16%" class="rowhead" align="center">Current Bid</td>
<td width="10%" class="rowhead" align="center"># of Bids</td>
<td width="12%" class="rowhead" align="center">Questions</td>
<td width="11%" class="rowhead" align="center">Ends</td>
</tr>
<?
$sql="SELECT * FROM ".ADVERTISE." WHERE status='1' ".$where." ORDER BY add_id DESC";
$PageSize =30;
$StartRow =0;
include_once('paging-top.php');
if(mysql_num_rows($rs)>0)
{
$bgColor = "#ffffff";
for($i=0;$i<mysql_num_rows($rs);$i++)
{
$arradv=mysql_fetch_array($rs);
$countBid=Select_Qry("COUNT(id) AS bid",PROPOSAL,"add_id='".$arradv['add_id']."'","","","","");
$countprop=Select_Qry("COUNT(id) AS cid",QUESTION,"add_id='".$arradv['add_id']."'","","","","");

$pending=Select_Qry("COUNT(id) as PEND",PROPOSAL,"add_id='".$arradv['add_id']."' AND accept='0'","","","","");
$reject=Select_Qry("COUNT(id) as REJ",PROPOSAL,"add_id='".$arradv['add_id']."' AND accept='1'","","","","");
?>
<? if((SITE_STATUS_ADD($arradv['statusId'])=='1') && ($arradv['site_img']=='')){?>
<tr <? if($arradv['highlight']=='1'){?> bgcolor="#fff7cc"<? }?>><td align="left" valign="top" colspan="5" <? if($arradv['rowborder']==1){?>class="rowborder"<? }?>>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="39%" align="left" class="txtLabel" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="32"><? if($arradv['featured']=='1'){?><img src="http://www.warriorforum.com/images/fd.png" border="0" alt="Featured" title="Featured" /><? }else{?><img src="http://www.warriorforum.com/images/spacer.gif" border="0" height="32" width="32"/><? }?></td>
<td width="287" align="left" style="padding-left:5px;"><a href="./<?=remspace($arradv['add_id'])?>" <? if($arradv['bold']==1){?>class="bold"<? }?>><?=substr(strip_tags($arradv['title']),0,40)?></a><br /><br /><strong>Visitors:</strong> <?=SITE_STATUS($arradv['site_status_name'])?></td>
</tr>
</table>
</td>
<td width="16%" align="center">-<?php /*?><?=$arradv['price']?><?php */?></td>
<td width="10%" align="center">-<?php /*?><?=$countBid['bid']?><?php */?></td>
<td width="12%" align="center"><?=$countprop['cid']?></td>
<td width="11%" align="center"><?=enddate($arradv['valid_till'])?></td>
</tr>
</table>
</td></tr>
<tr><td colspan="5" style="border-bottom:0px dashed #CCCCCC;"></td></tr>
<? }else{?>
<tr <? if($arradv['highlight']=='1'){?> bgcolor="#fff7cc"<? }?>><td align="left" valign="top" colspan="5" <? if($arradv['rowborder']==1){?>class="rowborder"<? }?>>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="39%" align="left" class="txtLabel" valign="top"><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="32"><? if($arradv['featured']=='1'){?><img src="http://www.warriorforum.com/images/fd.png" border="0" alt="Featured" title="Featured" /><? } else{?><img src="http://www.warriorforum.com/images/spacer.gif" border="0" height="32" width="32" /><? }?></td>
<td width="50" align="left"><a href="./<?=remspace($arradv['add_id'])?>"><img src="websiteImage/thumb<?=$arradv['site_img']?>" border="0" class="img_border" /></a></td>
<td width="287" align="left" style="padding-left:5px;"><a href="./<?=remspace($arradv['add_id'])?>" <? if($arradv['bold']==1){?>class="bold"<? }?>><?=substr(strip_tags($arradv['title']),0,40)?></a><br /><br /><strong>Visitors:</strong> <?=SITE_STATUS($arradv['site_status_name'])?></td>
</tr>
</table>
</td>
<td width="16%" align="center">
<? if($arradv['status']==2){
$acbin=Select_Qry("bin_amt, COUNT(id) as ACCBIN",BIN,"accept > '1' AND add_id ='".$arradv['add_id']."'","","","","");
if($acbin['ACCBIN'] >0){
$price=$acbin['bin_amt'];
}else {
$price=$arradv['price'];
}
}else{
$price=$arradv['price'];
}
?>
<?=$price ?></td>
<td width="10%" align="center">
<?
if($arradv['winner_id']=="0")
{
?>
<?=$countBid['bid']?><br/><?
}else{
?><span style="color:#FF0033">Sold</span><? }?></td>
<td width="12%" align="center"><?=$countprop['cid']?></td>
<td width="11%" align="center"><?=enddate($arradv['valid_till'])?></td>
</tr>
</table>
</td></tr>
<tr><td colspan="5" style="border-bottom:0px dashed #CCCCCC;"></td></tr>
<? }?>
<?
}
?>
<tr><td colspan="5" align="right" valign="top"><? include_once('pageno.php');?></td></tr> <?
}else{
?>
<tr><td colspan="5" align="center" valign="top"><?=errormessage("No postings")?></td></tr>
<?
}
?>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</p>
<div class="sidebar_sep"></div>
</td>
</tr>
</table>
</div>
<? require_once("upper-footer.php"); ?>
</div></div></div>
<? require_once("footer.php");?>

</body>
</html>
#categories #php #problem #set
  • Profile picture of the author viescripts
    You seem to have posted a dump of code with no explanations of how it should work and no additional files like your config and no DB structure.

    If you need help, remove all redundant stuff, leave only forms and code and explain in a few words how it should work, then describe what works wrong.

    I can give you 10-20 minutes of my time to correct your bugs, give advices or send you a piece of code to make you understand where you should move further.
    But spending here hours on understanding then correcting is not my goal on this forum. I think the others will agree with me.
    {{ DiscussionBoard.errors[7213192].message }}
    • Profile picture of the author Wags
      im sorry i do not know anything about coding and i just copied and pasted the code from the first set of cats php page and changed the parts that said category to the new category db id which is "statusid" so i wouldnt know which bit people would need to look at which is why i pasted all code, my site is in my sig if it helps
      {{ DiscussionBoard.errors[7213225].message }}
      • Profile picture of the author viescripts
        okay, then you can do it in another way:
        - describe how the page should work and where the bug is

        and post the url to web-page with problems. We'll try to help.
        {{ DiscussionBoard.errors[7213249].message }}
  • Profile picture of the author Wags
    ok the problem is in the visitors category , which is on most pages including home page and they link to page search1.php which should return separate results depending on which link that is clicked as a normal set of categories should, but when any of the visitor categories are click it shows all listings from all visitor cats, each listing is in both sets of categories as well e.g ad size and visitor categories
    hope this is ok paul Advert Flip - Fixed Price Advertising Marketplace

    my function for this is

    function SITE_STATUS($id)
    {
    $siteStatus=Select_Qry("*",SITE_STATUS,"statusId=' ".$id."'","","","","");
    return $siteStatus['status_name'];
    }
    function SITE_STATUS_ADD($Id)
    {
    $addspace=Select_Qry("*",SITE_STATUS,"statusId='". $id."'","","","","");
    return $addspace['add_space'];
    }
    {{ DiscussionBoard.errors[7213307].message }}
  • Profile picture of the author Wags
    Originally Posted by xuled View Post

    This is huge code and i can not look this up at the moment.
    no problem thx for the reply
    {{ DiscussionBoard.errors[7213382].message }}
  • Profile picture of the author Wags
    thx for all your help but i managed to solve the problem myself
    {{ DiscussionBoard.errors[7215331].message }}

Trending Topics