After a lot of trial and error... reading things that i did not understand and slowly putting the puzzles together, i figured out what my problem was.
I was approaching my problem with the wrong solution. I was trying to keep my sorting the information and hold it to the following pages. I thought that the cookies needed to be set to achieve this, but i was wrong. there was another way. THE RIGHT WAY
here was were the problem was...
for ($i=1;$i<=$pages;$i++) {
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
if (!(($offset/$limit)==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">$nextLink</a><p>\n";
}
It was in this line that i had the error. I created buttons that would change the $sortby variable: example
<a href=\"$PHP_SELF?sortby=type\">Type</a>
<a href=\"$PHP_SELF?sortby=make\">Make</a>
<a href=\"$PHP_SELF?sortby=model\">Model</a>
etc.....
and by simply putting $sortby into the line, I got exactly what i was looking for.
it should have looked like this.
for ($i=1;$i<=$pages;$i++) {
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset&sortby=".$sortby."\">$i</a> \n";
}
if (!(($offset/$limit)==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
}
if ($newoffset<=$limit){
print "<a href=\"$PHP_SELF?offset=$newoffset&sortby=".$sortby."\">$nextLink</a><p>\n";
}
I hope this helps anyone that was or is having the same problem i was having.