Home > Category Listing "; $header_code = ''; // prevent loading without a page $use_header = '1'; $connectdb = '1'; // get config file include('config.php'); /////////////////////////////////////////// $mquery = "SELECT * FROM game_cat"; $mresult = mysqli_query($dbcon, $mquery, $db); $mquery_data = mysqli_fetch_row($mresult); print "
EOM; $cat_id = trim($_REQUEST['cid']); // clean up data // restrict data type for var $cat_id = preg_replace('/([^0-9])/', "", $cat_id); if($cat_id == "" || $cat_id > 50){ // print the default list //printCategoryList(); // print the menu blob generated in the header print "\n
"; //3. Calculate number of $lastpage //This code uses the values in $rows_per_page and $numrows in order to identify the number of the last page. $rows_per_page = 30; $lastpage = ceil($numrows/$rows_per_page); //4. Ensure that $pageno is within range //This code checks that the value of $pageno is an integer between 1 and $lastpage. $pageno = (int)$pageno; if ($pageno < 1) { $pageno = 1; } elseif ($pageno > $lastpage) { $pageno = $lastpage; } // if //5. Construct LIMIT clause //This code will construct the LIMIT clause for the sql SELECT statement. $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; //print "LIMIT: $limit "; //6. Issue the database query //Now we can issue the database qery and process the result. $query = "SELECT * FROM game_list WHERE category = '$cat_id' AND enabled = '1' $limit"; $result = mysqli_query($dbcon, $query, $db); ////////////////////////////////////// // No results? if($numrows == 0){ print "Sorry, there are no games in this category at this time."; print << |
$display_name Played $times_played times |