View Single Post
Old 12-07-2007, 08:49 PM   #2 (permalink)
bdm
The Acquainted
Good Samaritan 
 
Join Date: Nov 2007
Posts: 127
Thanks: 14
bdm is on a distinguished road
Default

Nice approach.

Note that I'm not an OOP wizard, but hopefully these tips will help you and if someone disagrees, let me know.
- What version of PHP are you using? Because I've noticed that you're still using the var.
- You must sanitize your data ($_GET['p']) before executing a query (see below). Either use mysql_real_escape_string() or make up a regular expression to weed out all non-numbers.
- It'd be neat if you modified the class to support method chaining.

For example:
PHP Code:
$page= new pagination;
$page->connect("host","username","password","dbname");
$page->setMax(25)
     ->
setData("tablename")
     ->
display()
     ->
displayLinks(5
- I do believe that for greater flexibility, that you should perhaps accept the dots ('.....') as a parameter in your constructor.
- I'm anal about standards, but you should replace <br> with <br />

You should probably have a look at the following. http://dalemooney.lost-soldiers.com/...imple.php?p=1-
http://dalemooney.lost-soldiers.com/...le.php?p='
bdm is offline  
Reply With Quote
The Following User Says Thank You to bdm For This Useful Post:
Rendair (12-10-2007)