| |
| Originals |
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;
// Run your query with the limit and offset in place
$result_main = mysql_query("SELECT * FROM Prints WHERE AnimalSubClass='Original' ORDER by $sortby limit $start, $per_page") or die(mysql_error());
echo <<
|
Originals Section Coming, please select another category!
|
HTML;
// 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 "";
}
if($Soldout == "Yes"){
$price = "\" Sold Out \"";
}
else {
$price = "$" . $PrintPrice;
}
echo <<
HTML;
// increment counter - if counter = max columns, reset counter and close row
if(++$c == $max_num_columns){
echo " ";
$c = 0;
}
}
// clean up table - makes your code valid!
if($c < $max_num_columns){
for($e = $c; $e < $max_num_columns; $e++){
echo " ";
}
}
echo " \n";
?>
Originals Section Coming, please select another category\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 " ";
$c = 0;
}
}
// clean up table - makes your code valid!
if($c < $max_num_columns){
for($e = $c; $e < $max_num_columns; $e++){
echo " ";
}
}
echo " \n";
?> |
|