`

<script type="text/javascript">
function category(cid)
{
    if(cid !="")
    {   $('#process').show('slow');
        $.post('<?php echo BASEDIR ?>/ajax.php',{action:'search_subcategory_by_category_for_advsearch','cid':cid}, function(data)
        {
        $('#process').hide('fast');
        //  $('#process');

            $("#scid").html(data);
        }
         ); 
    }   
}
function subcategory(scid)
{
    if(scid!='')
    {  $('#process2').show('slow');
        $.post('<?=BASEDIR?>/ajax.php',{action:'select_template_by_subcategory_for_refine','scid':scid},function (data)
        { 
        $('#process2').hide('fast');
        $("#specification").html(data); }); 
        }   
}

</script>
<div class="lftpanel">
<div class="fl"><img src="<?=BASEDIR?>/images/browse_left.jpg" width="7" height="36" /></div>
<div class="brow_bg">Refine Your Search</div>
<div class="fl"><img src="<?=BASEDIR?>/images/browse_right.jpg" width="7" height="36" /></div>
<div class="cb"></div>
<div class="lft_cate_block">
<div class="pdng10lft pdng10top">
<form name="advSearch" id="advSearch" action="<?=BASEDIR?>/advance_search_result_redirect.php" method="get">

<table border="0" cellpadding="0" cellspacing="0" class="refine_tbl">
  <tr>
    <td>Title :</td>
  </tr>
  <tr>
    <td><input type="text" name="title" id="title" class="input_srch_small" style="width:192px !important;" value=""></td>
  </tr>
  <tr>
    <td>Price Range :</td>
  </tr>
  <tr>
    <td><input name="price_start" id="price_start" type="text" class="input_srch_small"  onblur="if(this.value=='') this.value='Minimum'" onfocus="if(this.value=='Minimum') this.value=''" value="Minimum"/><div class="to">To</div><input name="price_end" id="price_end" type="text" class="input_srch_small"  onblur="if(this.value=='') this.value='Maximum'" onfocus="if(this.value=='Maximum') this.value=''" value="Maximum"/></td>
  </tr>
<tr>
<td>Category :</td>
</tr>
<tr>
<td><select name="cid" id="cid" class="select_srch_small02" onChange="category(this.value)">
<option value="">Any</option>
<?php 
$categoriesAsearch = select("cname,cid","category","where status = 1 order by cname ASC");

while($categorySubHead = mysql_fetch_object($categoriesAsearch))
    {
        if($cid !='')
        {
        $sel=selected($categorySubHead->cid,$cid);
        }
        elseif($_REQUEST['cid'])
        {
        $sel=selected($categorySubHead->cid,$_REQUEST['cid']);
        }
    ?>
    <option value="<?=$categorySubHead->cid;?>" <?=$sel?>><?=$categorySubHead->cname;?></option>
    <?php 
    }
    ?>
</select></td>
</tr>
<tr>
    <td> <div id="process" name="process" style="display:none;text-align:center;"><img src="<?=BASEDIR?>/images/process.gif"  ></div></td>
</tr>
 <tr>
    <td>Sub Category :</td>
  </tr>
  <tr>
    <td><select name="scid" id="scid" class="select_srch_small02" onChange="subcategory(this.value)">
      <option value="">Any</option>
       <?php
       $brandId=select("*","sub_category","where cid='".$cid."' and status = 1 GROUP BY scid");
        if(mysql_num_rows($brandId)>0)
        {
            while($brandIdVal=mysql_fetch_object($brandId))
            {
                if($scid !='')
                {
                    $sel=selected($brandIdVal->scid,$scid);
                }
                elseif($_REQUEST['scid'])
                {
                    $sel=selected($brandIdVal->scid,$_REQUEST['scid']);
                }
                    ?>
                    <option value="<?=$brandIdVal->scid;?>" <?=$sel?> ><?=$brandIdVal->name;?></option>
                    <?php
            }
        }
        else
        {
            ?>
            <option value="" >No Sub Category</option>
            <?php 
        }
        ?>
      </select></td>
  </tr>


   <tr>
    <td>Location :</td>
  </tr>
  <tr>
    <td>
    <?php $locationsSubHead = select("location_id,name","location","where status = 1 order by name ASC"); ?>
          <select name="location_id" id="location_id" class="select_srch_small02">
     <option value="">Entire Malaysia</option>
     <?php while($locationSubHead = mysql_fetch_object($locationsSubHead))
        {
        if($location_id !='')
        {
        $sel=selected($locationSubHead->location_id,$location_id);
        }
        elseif($_REQUEST['location_id'])
        {
        $sel=selected($locationSubHead->location_id,$_REQUEST['location_id']);
        }
    ?>
    <option value="<?=$locationSubHead->location_id;?>" <?=$sel?>><?=$locationSubHead->name;?></option>
    <?php 
    }
    ?>
     </select>
    </td>
  </tr>
  <tr>
    <td> <div id="process2" name="process2" style="display:none;text-align:center;"><img src="<?=BASEDIR?>/images/process.gif"  ></div></td>
</tr>


<tr >
<td> <table id="specification">
<?php 
$template_id1 = selectfetch("template_id","specification_template","where cid = '".$cid."' and scid = '".$scid."' and status = 1 and tmp_type = 1");

$template_id2 = selectfetch("template_id","specification_template","where cid = '".$cid."' and scid = '".$scid."' and status = 1 and tmp_type = 2");

$specification1=select("DISTINCT spec_category_id","group_specificationjauction","where template_id='".$template_id1->template_id."' GROUP BY spec_id");

$specification2=select("DISTINCT spec_category_id","group_specificationjauction","where template_id='".$template_id2->template_id."' GROUP BY spec_id");

if(mysql_num_rows($specification1)>0)
        {
            while($specificationVal=mysql_fetch_object($specification1))
            {
                $cat = selectfetch("*","specification_category","where spec_category_id='".$specificationVal->spec_category_id."' and status = 1");
                ?>
                <tr><td>
                <input  name="spec_category_id1[]" id="spec_category_id1[]" type="hidden" value="<?=$cat->spec_category_id?>">
                <input type="hidden" id="template_id1" name="template_id1" value="<?=$template_id1->template_id?>">
                </td></tr>
                <?php 
                $atriTemp = select("spec_attribute_id","group_specificationjauction","where template_id='".$template_id1->template_id."' and spec_category_id = '".$specificationVal->spec_category_id."' GROUP BY spec_id");
                if(mysql_num_rows($atriTemp)>0)
                {
                    while($atriTempVal=mysql_fetch_object($atriTemp))
                    {
                        $alrt = selectfetch("*","specification_attribute","where spec_attribute_id='".$atriTempVal->spec_attribute_id."' and status = 1");
                        ?>
                        <tr>
                            <td><?=$alrt->name;?> : <input name="spec_attribute_id1[]" id="spec_attribute_id1[]" type="hidden" value="<?=$alrt->spec_attribute_id?>" ></td>
                        </tr>
                        <tr>
                            <td>
                            <select class="select_srch_small02" name="spec_attribute_val1[]" id="spec_attribute_val1">
                                <option value="">Any</option>
                                <?php $attribute_value = select("*","specification_attribute_value","where spec_attribute_id = '".$alrt->spec_attribute_id."' and spec_category_id ='".$specificationVal->spec_category_id."' ");
                                while($value = mysql_fetch_object($attribute_value))
                                {
                                ?>
                                <option value="<?=$value->value_id?>"><?=$value->name?></option>
                                <?php
                                }?>
                            </select>
                            </td>
                        </tr>
                        <?php    
                    }
                }
            }
        }

        if(mysql_num_rows($specification2)>0)
        {
            while($specificationVal=mysql_fetch_object($specification2))
            {
                $cat = selectfetch("*","specification_category","where spec_category_id='".$specificationVal->spec_category_id."' and status = 1");
                ?>
                <tr></td>
                 <input  name="spec_category_id2[]" id="spec_category_id2[]" type="hidden" value="<?=$cat->spec_category_id?>">
                     <input type="hidden" id="template_id2" name="template_id2" value="<?=$template_id2->template_id?>">
                     </td></tr>
                <?php 
                $atriTemp = select("spec_attribute_id","group_specificationjauction","where template_id='".$template_id2->template_id."' and spec_category_id = '".$specificationVal->spec_category_id."' GROUP BY spec_id");
                if(mysql_num_rows($atriTemp)>0)
                {
                    while($atriTempVal=mysql_fetch_object($atriTemp))
                    {
                        $alrt = selectfetch("*","specification_attribute","where spec_attribute_id='".$atriTempVal->spec_attribute_id."' and status = 1");
                        ?>
                        <tr>
                            <td><?=$alrt->name;?> : <input name="spec_attribute_id2[]" id="spec_attribute_id2[]" type="hidden" value="<?=$alrt->spec_attribute_id?>" ></td>
                        </tr>
                        <tr>
                            <td>
                            <select class="select_srch_small02" name="spec_attribute_val2[]" id="spec_attribute_val2">
                                <option value="">Any</option>
                                <?php $attribute_value2 = select("*","specification_attribute_value","where spec_attribute_id = '".$atriTempVal->spec_attribute_id."' and spec_category_id ='".$specificationVal->spec_category_id."' ");
                                while($value2 = mysql_fetch_object($attribute_value2))
                                {
                                ?>
                                <option value="<?=$value2->value_id?>"><?=$value2->name?></option>
                                <?php
                                }?>
                            </select>
                            </td>
                        </tr>
                        <?php    
                    }
                }
            }
        }
        ?>

  </table></td></tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><input type="submit" value="Refine" class="send_btn fn" style="cursor:pointer"></td>
  </tr>
  <tr>
    <td align="center"></td>
  </tr>
  </table>
  </form>
</div>
<div class="cb"></div>


</div>
<div class="cb"></div>
<div class="innerrgtga lga">

<div class="featued_block" style="width:235px;">
<div class="featued_block_heading">Sponsored Showcase
</div>

<!--jcarousel-->
<ul >




<?php
$nowDate = date("Y-m-d");

$fetAds =  select("ps.pid","premium_services ps,products p","where ps.ps_cid = 4 and ps.start_date <= '$nowDate' and ps.end_date >= '$nowDate' and p.pid = ps.pid and p.status = 1 order by ps.ps_id DESC limit 0,12");
$countFetAds = mysql_num_rows($fetAds);
if($countFetAds >0)
{
    while($fetads = mysql_fetch_object($fetAds))
    {

        $product = selectfetch("title,price,pid,scid","products","where pid = '".$fetads->pid."' and status_store = 1 and status = 1");
        //print_r($product);
        $productImage = selectfetch("img_name","photo_album","where pid = '".$product->pid."' and cover_photo = 1");
        if($productImage->img_name=='')
        {
            $productImage = selectfetch("img_name","photo_album","where pid = '".$product->pid."'");
        }
        $productTitle =  stripslashes(str_replace(" ","-",$product->title));
        $productTitle =  stripslashes(str_replace("/","~",$productTitle));
        $productTitle =  stripslashes(str_replace("?","",$productTitle));
        $enpid = base64_encode($product->pid);
        $hrefAdsdetail = href('product_detail.php','title='.$productTitle.'&pid='.$enpid);  

        //---------Price/Salary/Rent-------------// 
        $scid = $product->scid;
        if($scid!='')
        {
            $price_id = selectfetch("price_id","price_subcategory","where scid= $scid");
            if($price_id->price_id !='')
            {
                $priceName = selectfetch("name","price","where price_id = $price_id->price_id");
                $price = $priceName->name;
            }
            else
            {
                $price = 'Price';   
            }
        }
        else
        {
            $price = 'Price';   
        }
        //---------Price/Salary/Rent-------------// 
        ?>
     <li><div class="featured_img_block">
    <div class="fea_img_div">
    <?php $ps = selectfetch("end_date","premium_services","where pid = '".$product->pid."' and ps_cid = 2");
    $cutentDate = strtotime(date("Y-m-d"));
    $endDate = strtotime($ps->end_date);
    if($endDate > $cutentDate)
    { ?>
    <div class="urgent"></div>
        <?php 
    }
    ?>
    <a href="<?=$hrefAdsdetail?>"><?php if($productImage->img_name !=''){ ?><img src="<?=BASEDIR?>/uploads/product/index/<?=$productImage->img_name?>" /><?php }else{ ?><img src="<?=BASEDIR?>/images/images.jpg" width="113" height="101" /><?php } ?></a></div>
    <div class="fea_cate_name"><?=substr($product->title,'0','13');?></div>
    <p class="offer">RM <?=number_format($product->price, 2, '.', '');?></p>
    </div></li>   

        <?php 
    }
}
else
{ 
?>
    <li><div class="featured_img_block">
    <div class="fea_img_div"><img src="<?=BASEDIR?>/images/noproduct.jpg" width="113" height="101" /></div>
    <div class="fea_cate_name">No Featured Product </div>
    <p class="offer"></p>
    </div></li> 
<?php   
}
?>
</ul>
<!--jcarousel close-->
<div class="cb"></div>
</div></div>


<!--featured panel start-->


<!--featured panel end-->

</div>

`

This is the warning....

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mytrader/public_html/includes/functions.php on line 288

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mytrader/public_html/adv_search_result.php on line 327

You will have to post both files you have problems in. From the above chunk of code I can't see where your error is (And I can't be bothered to read the whole thing to see where you are using mysql_num_rows()). Post them in different sets of code tags.

From a quick glance, I can only see the num_rows and fetch_object functions. No connect, and no query is executed.

Line 83/153/155/etc: Have you actually tried these SELECT statements as actual queries against your database? The field(s) specified in the SELECT field list are not the fields in the GROUP BY clause. Generally, the field list of a SELECT statement with a GROUP BY clause should include only the fields specified in the GROUP BY clause and other fields being operated on by aggrogate functions, like SUM, MAX, MIN, etc.

what do the functions: selected, select and selectfetch do?
and more inportant, where are the defined?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.