custom pagination help
Posted: Tue May 05, 2009 4:30 pm
Hey,
I have tried integrating pre-made pagination scripts into my site but all I get is errors because my script has got quite out of hand and is quite long and complicated
Anyway I am going to have to make my own, is there a way of using an if statement to use pagination? Heres my thoughts..
Set a variable called something like $resultcount which is set to 0. Each time the loop in the mysql results reaches the end it adds 1 to the $resultcount. Once $resultcount equals 40, the next results are shown on page 2 (In the URL ?page=2 for example so I can link to the next page) and so on etc...
I think this sounds quite reasonable. I have tried this out but... I know the PHP for the if statement and the adding 1 after each loop etc.. but just can't seem to figure out how to set results > 40 to a new page (?page=2 in the URL)?
Any ideas anyone?
I have tried integrating pre-made pagination scripts into my site but all I get is errors because my script has got quite out of hand and is quite long and complicated
Anyway I am going to have to make my own, is there a way of using an if statement to use pagination? Heres my thoughts..
Set a variable called something like $resultcount which is set to 0. Each time the loop in the mysql results reaches the end it adds 1 to the $resultcount. Once $resultcount equals 40, the next results are shown on page 2 (In the URL ?page=2 for example so I can link to the next page) and so on etc...
I think this sounds quite reasonable. I have tried this out but... I know the PHP for the if statement and the adding 1 after each loop etc.. but just can't seem to figure out how to set results > 40 to a new page (?page=2 in the URL)?
Any ideas anyone?