Category Select and Per Page problems

I’m not a seasoned coder in PHP, and I am having problems with one of the scripts on my site. It’s basically a database of “homebrew” games and applications everything is divided by categories. The problem I am having is that the selection doesn’t work properly. Say for instance you are in the “Nintendo DS” section for example. The url would be:

If you were to try and show 15 items per page as opposed to the default of 5 per page, it would send you to the wrong url:

What it should have done was this:
There are also some other similar problems I am having as well, like when I click the “>>” button which takes you to the next page it simply adds another “?page=1” to the end of the url everytime I click it like this:

When it should do this:

I hope you are still following me on this, I am trying to explain the best that I can.

You can take a look at the page and see what I mean by visiting and playing around with it yourself.

Here is my code for my “categoryResults.php”:



	$WHERE = "Category='".$_GET['cat']."'";
	header("Location: ./index.php");

$page = "search homebrew";

$pg = $_GET['page'];

if(!$_GET['cnt']){$cnt = 5;}
else{$cnt = $_GET['cnt'];}

if(!$pg){$pg = 1;}
$count = (($pg * $cnt)-$cnt);
if($count < 0){$count = 0;}
$query = mysql_query("SELECT ID,Title,Category,DishImage,description,ratingStr FROM ".$cfg['homebrewTable']." WHERE ".$WHERE." AND approved='yes' LIMIT ".$count.",".$cnt);
	echo "<p>";
	echo smallHomebrewTable($ID,$title,$category,$image,$description,$ratingStr,$cfg['bodyWidth']);
echo table(1,0,$cfg['bodyWidth']);
echo tr();
	echo td(1,"basicText","left",0,0,0,0," style='padding:5px;'").perPageSelect($cnt,"categoryResults.php","&cat=".$_GET['cat']).td(2);
	echo td(1,"basicText","right",0,0,0,0," style='padding:5px;'");
		echo pageLinks($cfg['homebrewTable'],"./categoryResults.php?cat=".$_GET['cat'],$WHERE,$pg,$count,$cnt);

	echo td(2);
echo tr(2);
echo table(2);



This has been driving me nuts for days now and I can’t seem to get it working properly. Any help would be greatly appreciated. Thanks! :D

That page looks to be working fine. I can’t find any of the issues you’re describing.

lol, this post can be disregarded. I spent all day yesterday nabbing those bugs. I got it working for the most part. Thanks for looking anyways.

Sponsor our Newsletter | Privacy Policy | Terms of Service