There are no records to display in the selected category, please select another\n";
exit;
}
// Set maximum number of rows and columns
$max_num_columns = 3;
if($sort == "2"){
$sortby = "PrintPrice";
}else{
$sortby = "ProductName";
}// Work out how many pages there are
$total_pages = ceil($num_records / $per_page);
// Get the current page number
if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1;
// Work out the limit offset
$start = ($page - 1) * $per_page;
echo <<
HTML;
// Build the previous link
if ($page > 1){
$prev = ($page -1);
echo "Previous ";
}
echo "
";
echo " ";
// Build the next link
if ($page < $total_pages){
$next = ($page +1);
echo " Next";
}
echo "
";
echo <<
HTML;
// Run your query with the limit and offset in place
$result_main = mysql_query("SELECT * FROM Prints WHERE AnimalClass='Bear' ORDER by $sortby limit $start, $per_page") or die(mysql_error());
echo <<
\n";
$c = 0;
while($row = mysql_fetch_array($result_main)){
// make the variables easy to deal with
extract($row);
// open row if counter is zero
if($c == 0){
echo "
";
echo " ";
// Build the next link
if ($page < $total_pages){
$next = ($page +1);
echo " Next";
}
echo "
";
echo <<
HTML;
?>
There are no records to display in the selected category, please select another\n";
exit;
}
// Set maximum number of rows and columns
$max_num_rows = 1;
$max_num_columns = 1;
$per_page = $max_num_columns * $max_num_rows;
// Work out how many pages there are
$total_pages = ceil($num_records / $per_page);
// Get the current page number
if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1;
// Get the category or assign a defailt
if (isset($_GET['cat'])) $cat = $_GET['cat']; else $cat = ""; // enter a default category here
// Work out the limit offset
$start = ($page - 1) * $per_page;
// Run your query with the limit and offset in place
$result_main = mysql_query("SELECT * FROM Prints ORDER by ProductName limit $start, $per_page") or die(mysql_error());
$num_columns = ceil(mysql_num_rows($result_main)/$max_num_rows);
$num_rows = ceil(mysql_num_rows($result_main)/$num_columns);
// Lets start creating tables and echoing code
echo "
\n";
$c = 0;
while($row = mysql_fetch_array($result_main)){
// make the variables easy to deal with
extract($row);
// open row if counter is zero
if($c == 0){
echo "
";
}
echo <<
HTML;
// increment counter - if counter = max columns, reset counter and close row
if(++$c == $max_num_columns){
echo "