Jump to content

pagination with my own code,


businessman332211@hotmail.com
 Share

Recommended Posts

IF you are trying to help me with this, please ignore the first 2 posts of mine, I posted 3 different posts in this thread. If you notice I did this instead of creating multiple threads, so look at the bottom one if you are going to help, that is the current stage I am at, and now I am totally up against a wall, can't figure this thing out.Ok I ditched all the tutorials, I ditched all this crap. I picked it up and tried to program my own from scratch. I have laid out the framework at the top, and I am going to pass the same stuff to each query, so it should work with each one. here is my code but I ran into a problem with it.You will see I started with general information, i prepared the universal variables. I also prepared my limit, and everything before hand, like it should be prepared. Then I started off testing my first query with this, to see if it was going to work. It didn't I got an error, If you look at the first query, I tried passing it the limit, and the other row number, then at the bottom, I tried create just a next link right now, but it's not working, it started giving me an error, I list that at the bottom. Actually it even shows the next page link, with the variables getting passed through it, but something about my query now is not right.Quote

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/b/c/h/bcharnas/html/display.php on line 52Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/b/c/h/bcharnas/html/display.php on line 53Next Page
Code:
	   <div class="overall">			<h3>Postings</h3>			<?php			// connect to database			mysql_connect("#####", "####", "#######");			mysql_select_db("joyel");			// get together the critical variables, and clean them up.				$postset = mysql_real_escape_string($_GET['ps']);				$school = mysql_real_escape_string($_GET['s']);				$category = mysql_real_escape_string($_GET['c']);				$subcategory = mysql_real_escape_string($_GET['sc']);				$limit = 50;				$limit = mysql_real_escape_string($limit);			if ($_GET['$rownumber']) {				$rownumber = $rownumber + 50;				$rownumber = mysql_real_escape_string($rownumber);			}else {				$rownumber = 0;				$rownumber = mysql_real_escape_string($rownumber);			}			// go through databases.  Easier to keep up with, let's start with database number 1			switch ($postset) {			// Work with database postset1				case "postset1":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' SORT BY dateentered				LIMIT $limit, $rownumber;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				while ($row = mysql_fetch_array($query)) {				echo "<hr />";				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				}				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumber={$rownumber}\">Next Page</a>";								break;			// work with database postset2				case "postset2":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset3				case "postset3":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);								while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset4				case "postset4":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset5				case "postset5":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset6				case "postset6":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset7				case "postset7":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset8				case "postset8":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			}			?>					</div>

Edited by businessman332211@hotmail.com
Link to comment
Share on other sites

OK,. I worked over all of those issues, can someone tell me why my next link isn't workingOk, I need some help if possible. I did some work on it, and so far it seems that pagination is very, very simple compared to waht I use to think. WHat I want to figure out though, is one thing. Everything seems to work but one thing, that one thing seems to be the actual next link. I have like 4-5 entries in the database, and lowered the limit numbers to 2 so I can test everything to make sure it works, if it all works with 2, then it'll work with 50. so When I tried it, everything worked fine, then when I click the button to go next, it displays the same results instead of new results? Any advice?Code:

<?phpsession_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><?phpinclude './includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion?></head><body><div id="wrap"><?phpinclude './includes/header.inc.php'; // inserts header, logo, and everything up there?>		<br style="clear: both;" />	<?phpinclude './includes/leftnav.inc.php'; // inserts left navigation?>		<div id="content">			<div class="overall">			<h3>Postings</h3>			<?php			// connect to database			mysql_connect("mysql185.secureserver.net", "####", "#####");			mysql_select_db("joyel");			// get together the critical variables, and clean them up.				$postset = mysql_real_escape_string($_GET['ps']);				$school = mysql_real_escape_string($_GET['s']);				$category = mysql_real_escape_string($_GET['c']);				$subcategory = mysql_real_escape_string($_GET['sc']);				$limit = 2;				$limit = mysql_real_escape_string($limit);			if ($_GET['$rownumber']) {				$rownumber = $rownumber + 2;				$rownumber = mysql_real_escape_string($rownumber);			}else {				$rownumber = 0;				$rownumber = mysql_real_escape_string($rownumber);			}			// go through databases.  Easier to keep up with, let's start with database number 1			switch ($postset) {			// Work with database postset1				case "postset1":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				}				echo "<hr />";				echo "<br />";				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumber={$rownumber}\">Next Page</a>";												break;			// work with database postset2				case "postset2":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset3				case "postset3":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);								while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset4				case "postset4":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset5				case "postset5":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset6				case "postset6":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset7				case "postset7":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset8				case "postset8":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			}			?>					</div>			</div><?phpinclude './includes/banner.inc.php'; // includes the banner, randomly selected from a database?>	<?phpinclude './includes/footer.inc.php'; // includes the page footer, bottom navigation copyright?></div></body></html>

Edited by businessman332211@hotmail.com
Link to comment
Share on other sites

After 3-4 cups of coffee, 2 headaches, and a major brain cramp, I finally have gotten a skeleton, workable system for pagination, and a thourough understanding of the basic concept behind it, so I can replicate it later, or customize it more when I have all this set in. For now I am against a wall, Ihave encountered 2 things with my script, and no matter how hard I think at this point, I cannot figure these 2 things out.THe system it self works perfectly, it is set up right, and for it to keep working, I can just change the number to 50, and it will use 50 results, as well as I can put it on every case switch and it will all work properly, the thing here is though, it works. However there are 2 issues I can't figure out.1. If they try to go previous, for instance if they go next 1 time, then previous 2 times, it passes there current script, adn starts showing a blank page, it keeps lessening that number, and never stops, so each time you hit previous, it goes to another blank page. 2. The same for next, you can keep going to next for ever. How can I factor in when to make it now show next, and not show previous, I don't want those showing up if there is nothing there, any advice on how I can fix this.

<?phpsession_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><?phpinclude './includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion?></head><body><div id="wrap"><?phpinclude './includes/header.inc.php'; // inserts header, logo, and everything up there?>		<br style="clear: both;" />	<?phpinclude './includes/leftnav.inc.php'; // inserts left navigation?>		<div id="content">			<div class="overall">			<h3>Postings</h3>			<?php			// connect to database			mysql_connect("mysql185.secureserver.net", "#####", "######");			mysql_select_db("joyel");			// get together the critical variables, and clean them up.				$postset = mysql_real_escape_string($_GET['ps']);				$school = mysql_real_escape_string($_GET['s']);				$category = mysql_real_escape_string($_GET['c']);				$subcategory = mysql_real_escape_string($_GET['sc']);				$limit = 2;				$limit = mysql_real_escape_string($limit);				if ($_GET['rownumberprev']) {				$rownumber = mysql_real_escape_string($_GET['rownumberprev']);				}elseif ($_GET['rownumbernext']) {				$rownumber = mysql_real_escape_string($_GET['rownumbernext']);				}else {				$rownumber = 0;				}			// go through databases.  Easier to keep up with, let's start with database number 1			switch ($postset) {			// Work with database postset1				case "postset1":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				}				echo "<hr />";				echo "<br />";				$rownumberprev = $rownumber - 2;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				$rownumbernext = $rownumber + 2;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";												break;			// work with database postset2				case "postset2":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset3				case "postset3":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);								while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset4				case "postset4":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset5				case "postset5":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);					while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset6				case "postset6":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset7				case "postset7":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			// work with database postset8				case "postset8":				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$query = mysql_query($select);				while ($row = mysql_fetch_array($query)) {								}				break;			}			?>					</div>			</div><?phpinclude './includes/banner.inc.php'; // includes the banner, randomly selected from a database?>	<?phpinclude './includes/footer.inc.php'; // includes the page footer, bottom navigation copyright?></div></body></html>

Edited by businessman332211@hotmail.com
Link to comment
Share on other sites

It sounds like you might need to determine the total number of possible pages and then when you calculate what the previous and next pages should be, you'd need to check those values against the total number of pages.My PHP is RUSTY, but something like this?

$rownumberprev = $rownumber - 2;if($rownumberprev < 0){	$rownumberprev = 0;}$rownumbernext = $rownumber + 2;if($rownumbernext > $maxrows){	$rownumbernext = $maxrows;}

Link to comment
Share on other sites

Does the "Previous" link still work? I looked closer at your SQL:

SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered LIMIT $rownumber, $limit;

Perhaps setting the $rownumbernext like the following would work:

$rownumbernext = $rownumber + $limit;if($rownumbernext > ($num_rows - $limit)){	$rownumbernext = ($num_rows - $limit);}

This way, if there are 50 records in your table ($num_rows) and you want to grab 2 ($limit) records per page, $rownumbernext would never get larger than 48. Clicking "Next" after that should keep the display on the last page.

Link to comment
Share on other sites

actually I just figured that out, what I am hoping someone can do now, is a script analysis, give me there personal advice on the overall script I am declaring it done, but I would hate for 2-3 months of the site being live, they start complaining, and I check and find out this script is somehow causing unexpected errors or somethign I wasn't expecting, especially on a live website. Anyone have any advice??

<?phpsession_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><?phpinclude './includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion?></head><body><div id="wrap"><?phpinclude './includes/header.inc.php'; // inserts header, logo, and everything up there?>		<br style="clear: both;" />	<?phpinclude './includes/leftnav.inc.php'; // inserts left navigation?>		<div id="content">			<div class="overall">			<h3>Postings</h3>			<?php			// connect to database			mysql_connect("mysql185.secureserver.net", "####", "######");			mysql_select_db("joyel");			// get together the critical variables, and clean them up.				$postset = mysql_real_escape_string($_GET['ps']);				$school = mysql_real_escape_string($_GET['s']);				$category = mysql_real_escape_string($_GET['c']);				$subcategory = mysql_real_escape_string($_GET['sc']);				$limit = 50;				$limit = mysql_real_escape_string($limit);				if ($_GET['rownumberprev']) {				$rownumber = mysql_real_escape_string($_GET['rownumberprev']);				}elseif ($_GET['rownumbernext']) {				$rownumber = mysql_real_escape_string($_GET['rownumbernext']);				}else {				$rownumber = 0;				}			// go through databases.  Easier to keep up with, let's start with database number 1			switch ($postset) {			// Work with database postset1				case "postset1":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset2				case "postset2":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset3				case "postset3":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset4				case "postset4":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset5				case "postset5":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset6				case "postset6":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset7				case "postset7":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			// work with database postset8				case "postset8":				// test query for total row numbers				$testselect = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school';";				$testquery = mysql_query($testselect);				$total_rows = mysql_num_rows($testquery);				// query db				$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND				subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered				LIMIT $rownumber, $limit;";				$query = mysql_query($select);				$num_rows = mysql_num_rows($query);				echo "<hr />";				while ($row = mysql_fetch_array($query)) {				echo "<br />";				echo "<a href=\"view.php\" title\"View Post\">{$row[itemtitle]}-{$row[price]}-				{$row[dateentered]}</a>";				echo "<br />";				$temp = true;				}				if ($temp != true) {				echo "We apologize but there were no results";					}				echo "<hr />";			if ($rownumber != 0) {				$rownumberprev = $rownumber - 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumberprev={$rownumberprev}\">Previous Page</a>";					echo "<br />";				}				if ($rownumber <= ($total_rows - 50)) {				$rownumbernext = $rownumber + 50;				echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc=				{$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>";					}				break;			}			?>					</div>			</div><?phpinclude './includes/banner.inc.php'; // includes the banner, randomly selected from a database?>	<?phpinclude './includes/footer.inc.php'; // includes the page footer, bottom navigation copyright?></div></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...