RE: [PHP] Newbie: Composition by Association - Pagination Class general question.
| From: | MEM | Date: | Sun, 19 Jul 2009 15:02:46 +0000 |
| Subject: | RE: [PHP] Newbie: Composition by Association - Pagination Class general question. | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295583@lists.php.net to get a copy of this message | ||
> I don't know much about PDO, but in raw MySQL SQL you'd have something
> similar to this...
>
> function Select($table, $where, $page = false, $perpage = 20)
> {
> $sql = 'select * from '.$table.' where '.$where;
> if ($page !== false)
> {
> $sql .= ' limit '.(($page-1)*$perpage).', '.$perpage;
> }
> // now run the query and return the results
> ...
> }
I believe I understand the pagination logic.
If I'd like to put some general mysql function, I will put them on the abstract DAO class.
However, I will not use a general CRUD because a DAO pattern works pretty well for now, and I still
don't understand if there is any advantage by using a general CRUD and DAO together. But, apart
from that, I do get the pagination logic I believe. What I don't get is how that logic could be
related with the DAOs.
Anyway, I will try to code some lines to see what comes out...
Regards and thanks for your time Stuart,
Márcio