Hai i am struggling to find out what is wrong with this code. the next and prev buttons are not working. So any guy can look at this the url is http://www.hindlist.com/subc/Administrative%20Jobs/

I am giving out the code for further detail. Pls look at it and reply.

<?php
    // session_start();
    //if(isset($_COOKIE['grou']))   setcookie("grou", $_COOKIE['grou'], time()+(2*3600)); 
    if(!isset($_GET['pageno'])) $_GET['pageno'] = 0;

/*$_GET['city']
$_GET['catg']
$_GET['country']*/
    if(isset($_COOKIE['counval']) && $_COOKIE['counval'] != '') $_GET['country'] = $_COOKIE['counval'];
    if(isset($_COOKIE['cityval']) && $_COOKIE['cityval'] != '') $_GET['city'] = $_COOKIE['cityval'];
    if(isset($_COOKIE['pageid']) && $_COOKIE['pageid'] != '') $_GET['pageno'] = $_COOKIE['pageid'];
    if(isset($_COOKIE['catval']) && $_COOKIE['catval'] != '') $_GET['catg'] = $_COOKIE['catval'];

    /*echo "country:".$_GET['country'];
    echo "&nbsp;&nbsp;&nbsp;cityval:".$_GET['city'];
    echo "&nbsp;&nbsp;&nbsp;catval:".$_COOKIE['catval'];
    echo "&nbsp;&nbsp;&nbsp;grouval:".$_COOKIE['grouval'];
    echo "&nbsp;&nbsp;&nbsp;pageno:".$_GET['pageno'];
        createCookie('counval', counval, 1);
        createCookie('cityval', cityval, 1);
        createCookie('catval', catval, 1);
        createCookie('grou', grouval, 1);
        createCookie('pageno', pageno, 1); */

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang='en' >
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title><?php $mpagename = 2; include 'title.php'; ?></title>
        <?php  include 'metatag.php'; ?>
        <link type="text/css" rel="stylesheet" href="<?php echo $baseurl; ?>_includes/css/Main.css">
<script type="text/javascript">
function closeCookies(){
        try{    
            createCookie('catg',"",-1); //createCookie('catg',"",-1);  
            createCookie('choice',"",-1);       
            //createCookie('step',"",-1); createCookie('step',"",-1);  
            createCookie('val',"",-1); //createCookie('val',"",-1);  
            createCookie('gid',"",-1); //createCookie('gid',"",-1); 
            createCookie('grou',"",-1); 
            createCookie('app',"",-1);
        } catch(e){}
    }
    function createCookie(name,value,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }
    function buildSubUrl(pageno, grouval, counval, cityval, catval, subcat){
        try{    createCookie('grou',"",-1); /* createCookie('pageno',"",-1); */ } catch(e){}        
        createCookie('grou', grouval, 1);   // createCookie('pageno',0,1);  
/*          urlstr  = 'subcategory.php?';
        if(counval != '') urlstr += 'country='+counval+'&';
        if(cityval != '') urlstr += 'city='+cityval+'&';
        urlstr += 'catg='+catval+'&sub='+subcat;    //'subcategory.php?country='+counval+'&city='+cityval+'&catg='+catval+'&sub='+subcat;
        window.location.href = urlstr;*/ 
    }
//adpage.php?sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$country.'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'&amp;pageid='.$result_row['aidno'].'
    function buildAdUrl(pageid, grouval, counval, cityval, catval, subcat){
        try{    createCookie('grou',"",-1); createCookie('pageid',"",-1);  } catch(e){}     
        createCookie('grou', grouval, 1);   createCookie('pageid',0,1); 
        /*urlstr  = 'adpage.php?';
        if(counval != '') urlstr += 'country='+counval+'&';
        if(cityval != '') urlstr += 'city='+cityval+'&';
        urlstr += 'catg='+catval+'&sub='+subcat+'&pageid='+pageid;  
        window.location.href = urlstr;*/ 
    }
    closeCookies();
</script>
    </head>
    <body>
        <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" style="height:165px;background: url('<?php echo $baseurl; ?>images/bg.gif') repeat-x left top;">
                        <tr>
                        <td valign="middle" align="left" style="padding-left:15px;padding-right:15px;width:250px;">
                            <a href="http://www.hindlist.com/" ><img src="<?php echo $baseurl; ?>images/logo.png" alt="Hindlist.com" align="middle" border="0"></a>
                        </td>
                        <td valign="top" align="center">
                            <form method="get" action="http://www.google.com/custom" target="google_window">
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tbody>
                                        <tr>
                                            <td align="left" valign="bottom">
                                                <!--<input type="radio"  name="sitesearch" value="" checked="checked"/> The Web-->
                                                <input name="sitesearch" value="www.hindlist.com" type="radio" checked="checked"><span style="font-size:12px;color:#0000FF;">Hindlist</span>
                                            </td>
                                            <td valign="bottom" align="center">
                                                &nbsp;&nbsp; <input name="q" class="clstextbox" size="20" maxlength="255" value="" type="text"> &nbsp; <input type="image" alt="search" src="<?php echo $baseurl; ?>images/find.gif" style="margin-top:10px;"><input value="www.hindlist.com" name="domains" type="hidden"><!--<input value="Search" type="submit">--><!-- <a href="http://www.google.com/"><img border="0" alt="Google" src="http://www.google.com/logos/Logo_25wht.gif"/></a> -->
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <input value=" " name="client" type="hidden">
                                <input value=" " name="forid" type="hidden">
                                <input value="ISO-8859-1" name="ie" type="hidden">
                                <input value="ISO-8859-1" name="oe" type="hidden">
                                <!--<input type="hidden" value="L:http://www.hindlist.com/Images/Logo.gif);S:http://www.hindlist.com/);" name="cof"/>-->
                                <input value="en" name="hl" type="hidden">
                            </form>
                            <div style="margin-top:5px;">
                                <a href="<?php echo $baseurl; ?>postanad"><img border="0" src="<?php echo $baseurl; ?>images/post-ad.gif" alt="" ></a>
                            </div>
                        </td>
                            <td valign="middle" align="left" style="width:200px;">
                                <a href="<?php echo $baseurl; ?>Advertise" class="menulink">Advertise With Us</a> <br> <a href="contact" class="menulink">Contact Us</a><br>
                                <script language="JavaScript1.2" type="text/javascript">
                                    function CreateBookmarkLink() {
                                    title = "free classified website for jobs, pets, sell, real estate, services, for sale";
                                    url = "http://www.hindlist.com/";
                                    //title = document.title
                                    //url =document.location.href
                                    if (window.sidebar) {
                                    // Mozilla Firefox Bookmark
                                    //alert(url)
                                    //alert(title)
                                    //alert("FIREFOX!")
                                    window.sidebar.addPanel(title, url,"");
                                    } else if( window.external ) {
                                    // IE Favorite"

                                    //url = document.URL
                                    //alert("YES IE")
                                    //alert(url)
                                    //alert(title)
                                    window.external.AddFavorite( url, title);
                                    }
                                    else if(window.opera && window.print) {
                                    // Opera Hotlist
                                    return true; }
                                    }
                                </script>
                                <a href="javascript:CreateBookmarkLink();" class="menulink">Add to Favorites</a>&nbsp;<font style="font-weight: bolder;" color="#ff0000">(Ctrl+D) </font>
                            </td>
                        </tr>
                        <tr>
                        <td colspan="3" valign="top" align="left">
                            <h2><span class="slogon">&nbsp;&nbsp;&nbsp;&nbsp;best of Free Ads<!--classified websites!--></span></h2>
                        </td>

                    </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td valign="top" class="tbborder">
                    <table cellpadding="0" cellspacing="0" style="min-width:978px;width:100%;background:#FFFFFF;margin:15px;">
                        <tr>
                            <td>
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td width="130px" style="padding-left:10px;" align="left">
                                            <table style="height: 65px;" width="100%" cellpadding="0" cellspacing="0">
                                                <tbody>
                                                    <tr><td><a class="menulink" href="<?php echo $baseurl; ?>index">Home</a></td></tr>
                                                    <tr><td><a class="menulink" href="<?php echo $baseurl; ?>postanad">Place an Ad</a></td></tr>
                                                    <tr><td><a class="menulink" href="<?php echo $baseurl; ?>removead">Remove an Ad</a></td></tr>
                                                </tbody>
                                            </table>
                                        </td>
                                        <td valign="top" align="center" width="780px">
                                            <table style="height: 65px;" width="96%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                <tbody>
                                                    <tr>
                                                        <td><b><font size="2" color="#ff0000" face="Century Gothic">&nbsp;</font></b></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                        <td width="150px" align="left">
                                            <table style="margin-left:20px;height: 65px;" width="100%" cellpadding="0" cellspacing="0">
                                                <tbody>
                                                    <tr><td><a href="<?php echo $baseurl; ?>terms" class="menulink">Terms of Use</a></td></tr>
                                                    <tr><td><a href="<?php echo $baseurl; ?>Privacy" class="menulink">Privacy Policy</a></td></tr>
                                                    <tr><td><a href="<?php echo $baseurl; ?>ScamAlert" class="menulink">Scam Alert</a></td></tr>
                                                </tbody>
                                            </table>
                                        </td>    
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="center"><div style="width:95%;"><!--<img height="1" alt="grey dot" style="width:100%;" src="images/gray_dot.gif">--></div></td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <table width="100%" border="0" cellpadding="0" cellspacing="10">
                                    <tbody>
                                        <tr>
                                            <td  height="100" align="center" style="min-width:650px;width:70%;">
                                                <div align="justify" class="breadcrums">
                                                    <?php
                                                        $continuestr = ''; $hturl = '';
                                                        //if(isset($_COOKIE['grou']) && !isset($_GET['grou'])) $_GET['grou'] = $_COOKIE['grou'];
                                                        if(isset($_GET['grou']) && $_GET['grou'] == 'comm')     {   $continuestr = 'Community'; $hturl = 'community'; $gid = 1; }
                                                        else if(isset($_GET['grou']) && $_GET['grou'] == 'pers'){   $continuestr = 'Personals'; $hturl = 'personals';   $gid = 2; }
                                                        else if(isset($_GET['grou']) && $_GET['grou'] == 'real'){   $continuestr = 'Real Estate'; $hturl = 'realestate';    $gid = 3; }
                                                        else if(isset($_GET['grou']) && $_GET['grou'] == 'jobs'){   $continuestr = 'Jobs';  $hturl = 'jobs';        $gid = 4; }
                                                        else if(isset($_GET['grou']) && $_GET['grou'] == 'serv'){   $continuestr = 'Services';  $hturl = 'services';    $gid = 5; }
                                                        else if(isset($_GET['grou']) && $_GET['grou'] == 'fors'){   $continuestr = 'For Sale';  $hturl = 'forsale'; $gid = 6; }

                                                        $countryword = ''; $cityword = ''; $groupword = ''; $catgword = ''; $finalword = '';

                                                        $urlarray = array("urlname" => array(), "urllink" => array());
                                                        $alen = 0;

                                                        if(isset($_GET['country']) && $_GET['country'] != '')
                                                        { 
                                                            $urlarray["urlname"][$alen] = setEscapeChar1($_GET['country']); 
                                                            $urlarray["urllink"][$alen++] = '<a href="'.$baseurl.'country/'.$_GET['country'].'">'.setEscapeChar1($_GET['country']).'</a>';

                                                            if(isset($_GET['city']) && $_GET['city'] != ''){                
                                                                $urlarray["urlname"][$alen] = setEscapeChar1($_GET['city']); 
                                                                $urlarray["urllink"][$alen++] = '<a href="'.$baseurl.'country/'.$_GET['country'].'/city/'.$_GET['city'].'">'.setEscapeChar1($_GET['city']).'</a>'; 
                                                            }
                                                        }

                                                        if($continuestr != '')
                                                        {
                                                            $urlarray["urlname"][$alen]   = $continuestr; 
                                                            $urlarray["urllink"][$alen++] = ''; 
                                                            $tcity = '';
                                                            if(isset($_GET['city'])) $tcity = $_GET['city'];
                                                            $urlarray["urlname"][$alen] = $_GET['catg'];
                                                            $uurlstr  = $baseurl;
                                                            if($tcity == '')           $uurlstr .= 'group/'.$hturl.'/';
                                                            if($_GET['country'] != '') $uurlstr .= 'country/'.$_GET['country'].'/';
                                                            if($tcity != '')           $uurlstr .= 'city/'.$tcity.'/';
//                                                          else 
                                                            //$uurlstr .= 'catg='+catval+'&sub='+subcat; 
                                                            $urlarray["urllink"][$alen++] = '<a href="'.$uurlstr.'cat/'.$_GET['catg'].'">'.resetEscapeChar($_GET['catg']).'</a>';
                                                        }

                                                        if(isset($_GET['sub']) && $_GET['sub'] != '')
                                                        {   
                                                            $tcity = '';
                                                            if(isset($_GET['city'])) $tcity = $_GET['city'];            
                                                            $urlarray["urlname"][$alen] = $_GET['sub']; 
                                                            $urlarray["urllink"][$alen++] = '<a href="'.$baseurl.'sub/country/'.$_GET['country'].'/city/'.$tcity.'/cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/0">'.resetEscapeChar($_GET['city']).'</a>'; //subcat
                                                        }
                                                        if(isset($_GET['grou']))
                                                        {
                                                            $disstr = ''; //echo "---------------".$alen; 
                                                            for($i=0;$i<$alen;$i++)
                                                            {
                                                                if($i != 0) $disstr .= ' &gt; ';                
                                                                if(($urlarray["urllink"][$i] == '') || ($i == $alen-1)) $disstr .= $urlarray["urlname"][$i];
                                                                else                                                    $disstr .= $urlarray["urllink"][$i];                                
                                                            }
                                                            echo resetEscapeChar($disstr);
                                                            unset($urlarray); 
                                                        }//echo $finalword; 
                                                    ?>
                                                </div>
                                                <br>
                                                <!-- General message customized for each page  -->
                                                <?php if($_GET['catg'] != '')
                                                      {     
                                                        //if($_GET['grou'] != 'pers' || (isset($_GET['app']) && $_GET['app'] == 1)){            
                                                        $myDB = new MySQLDB();
                                                    //  echo 'In category';
                                                        $sql = "SELECT scateno, cateno, scatename FROM hl_subcategory WHERE cateno = (SELECT cateno FROM hl_category WHERE catename = '".resetEscapeChar($_GET['catg'])."')";

                                                        //$tarr = array(); $tcount = 0;
                                                        $cateno = 0; $scateno = 0;      
                                                        //echo $sql."<br>";  
                                                        if(isset($_GET['country'])) $country = $_GET['country']; else $country = '';
                                                        $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error());                            
                                                        while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){
                                                            //$tarr[$tcount++] = '<a class="link" href="subcategory.php?sub='.$result_row['scatename'].'&catg='.$_GET['catg'].'&country='.$country.'&city='.$_GET['city'].'&grou='.$_GET['grou'].'">'.$result_row['scatename'].'(#)</a><br><br>';
                                                            $cateno  = $result_row['cateno'];
                                                            //echo $result_row['scatename'] ." ".strcmp($result_row['scatename'],resetEscapeChar($_GET['sub']))." ".resetEscapeChar($_GET['sub'])."<br/>";
                                                            if(strcmp(trim($result_row['scatename']),trim(resetEscapeChar($_GET['sub'])))==0)
                                                            {
                                                                $scateno = $result_row['scateno'];
                                                            }
                                            //              break;
                                                        }       
                                                        mysql_free_result($result) or die("could not close result set <br>".mysql_error());          
                                                        $myDB->close(); 

                                                        $temstr = '';
                                                        $countryname = 'World';  $myDB = new MySQLDB(); $nav = 2;       
                                                        $sql = "SELECT artidesc FROM hl_articles";          
                                                        if($_GET['country'] != ''){
                                                            $countryname = $_GET['country'];
                                                            if($_GET['city'] != '') $countryname = $_GET['city'];               
                                                            $nav = 2;
                                                        }
                                                        $sql .= " WHERE groupid = ".$gid." AND cateno = ".$cateno." AND scateno = ".$scateno." AND navigation = ".$nav;
                                                        //echo $sql;
                                                        $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error());                            
                                                        while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){
                                                            $temstr = str_replace("|", $countryname, $result_row['artidesc']);
                                                        }       
                                                        mysql_free_result($result) or die("could not close result set <br>".mysql_error());          
                                                        $myDB->close();     

                                                        echo "<div class='message'>".$temstr."</div>";
                                                    }
                                                    else
                                                    {
                                                        $myDB = new MySQLDB(); $nav = 1;
                                                        if($_GET['country'] != '')  $countryname = $_GET['country'];
                                                        $sql = "SELECT artidesc FROM hl_articles WHERE navigation = ".$nav;
                                                        $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error());                            
                                                        while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC))
                                                        {
                                                            $temstr = str_replace("|",$countryname,$result_row['artidesc']);
                                                        }       
                                                        //echo $sql;
                                                        echo "<div class='message'>".$temstr."</div>";
                                                        mysql_free_result($result) or die("could not close result set <br>".mysql_error());          
                                                        $myDB->close();
                                                    }
                                                ?>
                                                <br>
                                                <div style="width:95%;"><!--<img height="1" alt="grey dot" style="width:100%;" src="images/gray_dot.gif">--></div>  
                                            </td>
                                            <td rowspan="3" style="min-width:328px;width:30%;font-weight:bold;" align="center">&nbsp;

                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top"  align="right" style="padding:10px;">
                                                <table width="100%" cellpadding="5" cellspacing="0" border="0" style="text-align:left;">
                                                    <?php 
                                                        // $_GET['sub'];
                                                        //  $_GET['catg'];

                                                        $myDB = new MySQLDB();                  
                                                        $sql  = "SELECT count(*) FROM hl_adsection
                                                                LEFT JOIN hl_subcategory ON hl_subcategory.scateno = hl_adsection.aidscat
                                                                left join hl_category on hl_adsection.aidcategory = hl_category.cateno 
                                                                left join hl_country on hl_country.countryid = hl_adsection.aidcountry 
                                                                left join hl_city on hl_city.cityid = hl_adsection.aidcity WHERE hl_adsection.aidstatus = 2 
                                                                AND hl_category.catename = '".resetEscapeChar($_GET['catg'])."' AND hl_subcategory.scatename = '".resetEscapeChar($_GET['sub'])."' ";   

                                                        // echo $sql;
                                                        if($_GET['country'] != ''){
                                                            $sql .= " AND hl_country.countryname = '".resetEscapeChar($_GET['country'])."'";
                                                            if($_GET['city'] != ''){
                                                                $sql .= " AND hl_city.cityname = '".resetEscapeChar($_GET['city'])."'";
                                                            }
                                                        }                               
                                                        $googlelimit = 11; $ccount = 0; $paginglimit = 22; $totalRecords = 0;
                                                        $sql .= " ORDER BY hl_adsection.adposted DESC";
                                                        //echo $sql;
                                                        $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error());
                                                        while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){                      
                                                            $totalRecords = $result_row['count(*)'];
                                                        }       
                                                        mysql_free_result($result) or die("could not close result set <br>".mysql_error());          
                                                        $myDB->close(); 

                                                        $pageSize = $paginglimit;
                                                        $pageCount = $totalRecords/$pageSize;
                                                        if ($pageCount > (int)$pageCount)
                                                        {
                                                            $pageCount = (int)$pageCount;
                                                            $pageCount++;
                                                        }                   

                                                        //  ******************************************************** This is the paging starting
                                                        if($_GET['pageno'] > 0){
                                                            $urstr = '<a class="link" href="'.$baseurl.'sub/';
                                                            if(isset($_GET['country']) && $_GET['country'] != '') $urstr .= 'country/'.$_GET['country'].'/';
                                                            if(isset($tcity) && $tcity != '') $urstr .= 'city/'.$tcity.'/';
                                                            if(isset($_GET['catg']) && $_GET['catg'] != '') $urstr .= 'cat/'.$_GET['catg'].'/';
                                                            if(isset($_GET['sub']) && $_GET['sub'] != '') $urstr .= 'sub/'.$_GET['sub'].'/';
                                                            if(isset($_GET['pageno']) && $_GET['pageno'] != '') $urstr .= 'pageno/'.($_GET['pageno']-1);

                                                            echo $urstr.'" onmouseover="javascript: buildSubUrl(0,\''.$_GET['grou'].'\',\'\',\'\',\'\',\'\');">&lt;Prev</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

                                                            //echo '<a class="link" href="'.$baseurl.'sub/country/'.$_GET['country'].'/city/'.$tcity.'/cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/'.($_GET['pageno']-1).'">&lt;Prev</a>&nbsp;&nbsp;'; 
//                                                          echo '<a class="link" href="'.$baseurl.'sub/pageno='.($_GET['pageno']-1).'&amp;sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$_GET['country'].'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'">&lt;Prev</a>';//subcat
                                                        }
                                                        //echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                                        if($_GET['pageno']+1 < $pageCount){
                                                            $urstr = '<a class="link" href="'.$baseurl.'sub/';
                                                            if(isset($_GET['country']) && $_GET['country'] != '') $urstr .= 'country/'.$_GET['country'].'/';
                                                            if(isset($tcity) && $tcity != '') $urstr .= 'city/'.$tcity.'/';
                                                            if(isset($_GET['catg']) && $_GET['catg'] != '') $urstr .= 'cat/'.$_GET['catg'].'/';
                                                            if(isset($_GET['sub']) && $_GET['sub'] != '') $urstr .= 'sub/'.$_GET['sub'].'/';
                                                            if(isset($_GET['pageno']) && $_GET['pageno'] != '') $urstr .= 'pageno/'.($_GET['pageno']+1);

                                                            echo $urstr.'" onmouseover="javascript: buildSubUrl(0,\''.$_GET['grou'].'\',\'\',\'\',\'\',\'\');">Next&gt;</a>';

//                                                          echo '<a class="link" href="'.$baseurl.'sub/country/'.$_GET['country'].'/city/'.$tcity.'/cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/'.($_GET['pageno']+1).'">Next&gt;</a>'; 
//                                                          echo '<a class="link" href="subcategory.php?pageno='.($_GET['pageno']+1).'&amp;sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$_GET['country'].'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'">Next&gt;</a>';
                                                        }
                                                        //  ******************************************************** This is the paging ending              


                                                        $myDB = new MySQLDB();                  
                                                        $sql  = "SELECT aidno, aidimage, aidcategory, aidcountry, aidcity, aidtitle, aiddescription, aidemailid, 
                                                                date_format(hl_adsection.adposted, '%W, %M %d, %Y') as poseteddate FROM hl_adsection
                                                                LEFT JOIN hl_subcategory ON hl_subcategory.scateno = hl_adsection.aidscat
                                                                left join hl_category on hl_adsection.aidcategory = hl_category.cateno 
                                                                left join hl_country on hl_country.countryid = hl_adsection.aidcountry 
                                                                left join hl_city on hl_city.cityid = hl_adsection.aidcity WHERE hl_adsection.aidstatus = 2 
                                                                AND hl_category.catename = '".resetEscapeChar($_GET['catg'])."' AND hl_subcategory.scatename = '".resetEscapeChar($_GET['sub'])."' ";   

                                                         //echo $sql;
                                                        if($_GET['country'] != ''){
                                                            $sql .= " AND hl_country.countryname = '".resetEscapeChar($_GET['country'])."'";
                                                            if($_GET['city'] != ''){
                                                                $sql .= " AND hl_city.cityname = '".resetEscapeChar($_GET['city'])."'";
                                                            }
                                                        }                               
                                                        $googlelimit = 11; $ccount = 0; $paginglimit = 22;      
                                                        $sql .= " ORDER BY hl_adsection.adposted DESC limit ".($_GET['pageno'] * $paginglimit).",$paginglimit";


                                                        //echo $sql;
                                                        $tdate = '';                    
                                                        $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error());
                                                        while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){                      
                                                            if($tdate != $result_row['poseteddate']){
                                                               $tdate  = $result_row['poseteddate'];
                                                               echo '<tr style="height: 10px; background-color: #A0B8C8;"><td align="left" colspan="2"><b>'.$tdate.'</b></td></tr>';
                                                            }
                                                            if($ccount == $googlelimit){
                                                               echo '<tr  class="entry-1"><td style="height: 50px;" colspan="2" align="center"><b>&nbsp;</b></td></tr>';
                                                            }
                                                            echo '<tr class="entry-1">';
                                                            echo '<td><span class="textHeader2">';
                                                            //buildAdUrl(pageno, grouval, counval, cityval, catval, subcat){
                                                            //echo '<a class="link" href="adpage.php?sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$country.'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'&amp;pageid='.$result_row['aidno'].'"><b>'.$result_row['aidtitle'].'</b></a></span><br>';
                                                            $urlstr  = $baseurl.'add/';
                                                            if($country != '') $urlstr .= 'country/'.$country.'/';
                                                            if($_GET['city'] != '') $urlstr .= 'city/'.$_GET['city'].'/';
                                                            $urlstr .= 'cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/'.$result_row['aidno'];   //adpage

                                                            echo '<a class="link" href="'.$urlstr.'" onmouseover="javascript: buildAdUrl('.$result_row['aidno'].', \''.$_GET['grou'].'\', \''.$country.'\', \''.$_GET['city'].'\', \''.$_GET['catg'].'\', \''.$_GET['sub'].'\');"><b>'.$result_row['aidtitle'].'</b></a></span><br>';
                                                            echo '<span class="textDesc">'.substr($result_row['aiddescription'],0,200).'...</span>';
                                                            echo '<br><span style="color:#9999CC;">Category: '.resetEscapeChar($_GET['catg']).'/'.resetEscapeChar($_GET['sub']).'</span>';
                                                            echo '</td>';
                                                            echo '<td width="60" align="center" valign="top"><a class="link" href="javascript: buildAdUrl('.$result_row['aidno'].', \''.$_GET['grou'].'\', \''.$country.'\', \''.$_GET['city'].'\', \''.$_GET['catg'].'\', \''.$_GET['sub'].'\');">';
                                                            if($result_row['aidimage'] == '' || $result_row['aidimage'] == NULL) 
                                                                 echo '<img border="0" src="'.$baseurl.'images/noImageAvailable.jpg" style="width: 50px; height: 50px;" alt="">';
                                                            else echo '<img border="0" style="width: 50px; height: 50px;" alt="" src="'.$baseurl.'image.php?imageid='.$result_row['aidno'].'">';                                             echo '</a></td>';
                                                            echo '</tr>';
                                                            $ccount++;
                                                        }       
                                                        mysql_free_result($result) or die("could not close result set <br>".mysql_error());          
                                                        $myDB->close(); 

                                                    ?>          
                                                </table>
                                                <?php 
                                                    echo "<br>";
                                                        //  ******************************************************** This is the paging starting
                                                        if($_GET['pageno'] > 0){
                                                            $urstr = '<a class="link" href="'.$baseurl.'sub/';
                                                            if(isset($_GET['country']) && $_GET['country'] != '') $urstr .= 'country/'.$_GET['country'].'/';
                                                            if(isset($tcity) && $tcity != '') $urstr .= 'city/'.$tcity.'/';
                                                            if(isset($_GET['catg']) && $_GET['catg'] != '') $urstr .= 'cat/'.$_GET['catg'].'/';
                                                            if(isset($_GET['sub']) && $_GET['sub'] != '') $urstr .= 'sub/'.$_GET['sub'].'/';
                                                            if(isset($_GET['pageno']) && $_GET['pageno'] != '') $urstr .= 'pageno/'.($_GET['pageno']-1);

                                                            echo $urstr.'" onmouseover="javascript: buildSubUrl(0,\''.$_GET['grou'].'\',\'\',\'\',\'\',\'\');">&lt;Prev</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

                                                            //echo '<a class="link" href="'.$baseurl.'sub/country/'.$_GET['country'].'/city/'.$tcity.'/cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/'.($_GET['pageno']-1).'">&lt;Prev</a>'; 
//                                                          echo '<a class="link" href="subcategory.php?pageno='.($_GET['pageno']-1).'&amp;sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$_GET['country'].'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'">&lt;Prev</a>   ';
                                                        }
                                                        //echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";                                                      
                                                        if($_GET['pageno']+1 < $pageCount){
                                                            $urstr = '<a class="link" href="'.$baseurl.'sub/';
                                                            if(isset($_GET['country']) && $_GET['country'] != '') $urstr .= 'country/'.$_GET['country'].'/';
                                                            if(isset($tcity) && $tcity != '') $urstr .= 'city/'.$tcity.'/';
                                                            if(isset($_GET['catg']) && $_GET['catg'] != '') $urstr .= 'cat/'.$_GET['catg'].'/';
                                                            if(isset($_GET['sub']) && $_GET['sub'] != '') $urstr .= 'sub/'.$_GET['sub'].'/';
                                                            if(isset($_GET['pageno']) && $_GET['pageno'] != '') $urstr .= 'pageno/'.($_GET['pageno']+1);

                                                            echo $urstr.'" onmouseover="javascript: buildSubUrl(0,\''.$_GET['grou'].'\',\'\',\'\',\'\',\'\');">Next&gt;</a>';

                                                            //echo '<a class="link" href="'.$baseurl.'sub/country/'.$_GET['country'].'/city/'.$tcity.'/cat/'.$_GET['catg'].'/sub/'.$_GET['sub'].'/pageno/'.($_GET['pageno']+1).'">Next&gt;</a>'; 
//                                                          echo '   <a class="link" href="subcategory.php?pageno='.($_GET['pageno']+1).'&amp;sub='.$_GET['sub'].'&amp;catg='.$_GET['catg'].'&amp;country='.$_GET['country'].'&amp;city='.$_GET['city'].'&amp;grou='.$_GET['grou'].'">Next&gt;</a>';
                                                        }
                                                        //  ******************************************************** This is the paging ending      
                                                ?>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>    
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="center" style="height:25px;background:#8CF3CD url('<?php echo $baseurl; ?>images/bg.gif') repeat-x left top;">
                    <?php include '_includes/hfooter.php'; ?>
                </td>
            </tr>
        </table>
        <script type="text/javascript">
            var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
            document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
            </script>
            <script type="text/javascript">
            try {
            var pageTracker = _gat._getTracker("UA-4598348-1");
            pageTracker._trackPageview();
            } catch(err) {}
        </script>
    </body>

</html>
Member Avatar for diafol

Read the forum guidelines (Announcements) PLEEEEEEEEEZE.

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.