'' order by city"); if (!$selrec){ $dispinfo = disperr(); } else { $rownum = mysql_num_rows($selrec); if ($rownum < 1) { $dispinfo = disperr(); } else { $nums = mysql_num_rows($selrec); //================ PAGINATION ==== $total_rec = 0; $page = (isset($_GET['pg'])) ? $_GET['pg'] : 1; $total_rec = $nums; $limit = 20; $total_pages = ceil($total_rec / $limit); // ---- PAGES NOT MORE THAN 10 if ($total_pages >= 11) { $total_pages = 10; } if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_pages)) { $page = 1; //default } //where we will start, or where we left off $set_limit = $page * $limit - ($limit); $disp_pages = 'Found: ' . $total_rec .', Page(s):'; //============ MOVE TO FIRST PAGE if ($page == 1) { $disp_pages .= ' << '; } else { $disp_pages .= ' << '; } //============ end MOVE TO FIRST PAGE for ($pg = 1; $pg <= $total_pages; $pg++ ) { if ($pg == $page) { $disp_pages .= ' '.$pg.' '; } else { $disp_pages .= ' '.$pg.' '; } } //============ MOVE TO LAST PAGE if ($page == $total_pages) { $disp_pages .= ' >> '; } else { $disp_pages .= ' >> '; } //============ END MOVE TO LAST PAGE // $disp_pages .= ''; //================ END PAGINATION ==== $selrec = mysql_query("select city, districts, stdcode, cityalias from cities where (statecode = 21 or statecode = 30) and stdcode <> '' order by city limit $set_limit, $limit "); // echo "select city, districts, stdcode, cityalias from cities where (statecode = 21 or statecode = 30) order by city limit $set_limit, $limit "; //================ PAGINATION ==== //echo $disp_pages; //================ END PAGINATION ==== //================ RESULTS DISPLAY if ($page > 1 ){ $st = (($page -1) * $limit) +1; } else { $st = 1; } $dispinfo = ''; $x = ($page - 1) * $limit ; while ($dbrows = mysql_fetch_array($selrec)) { $x += 1; $dispinfo .= ''.$x.''.$dbrows['city'].''.$dbrows['districts'].''.$dbrows['stdcode'].''; } //================ PAGINATION ==== //echo $disp_pages; //================ END PAGINATION ==== } } $title = 'STD Code, Punjab State'; $title = ucwords(removeSplCharSpace($title)); include '_includes/header.php'; ?>

STD Codes

'; echo $dispinfo ; echo ''.$disp_pages ; ?>
S.No.City/Town/VillageDistrictSTD Code