Advertisement
vanchelo

Untitled

Oct 14th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. class Res {
  3.    public $id;
  4.    public $pagetitle;
  5.  
  6.    public function info()
  7.    {
  8.       return '#'.$this->id.': '.$this->pagetitle;
  9.    }
  10. }  
  11.  
  12. $query = "SELECT id,pagetitle FROM modx_site_content LIMIT 10";
  13.  
  14. $result = $modx->prepare($query);
  15. $result->setFetchMode(PDO::FETCH_CLASS, 'Res');
  16. $result->execute();
  17. while ($res = $result->fetch()) {
  18.     echo $res->info().'<br />'."\n";
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement