Allora,
partiamo da un esempio base base con tutti i suoi problemi:
	Codice PHP:
	
class Person{   
private $id;   private $firstname;   private $lastname;
   private $db; //a PDO instance      public function __construct($firstname = null, $lastname = null){        $this->firstname = $firstname;        $this->lastname = $lastname;   }      public function setConnection(PDO $db){        $this->db = $db;   }      public function load($id){        $sql = "select * from people where id = :ID";                $sth = $this->db->prepare($sql);        $sth->execute(array(':ID' => $id ));        $result = $sth->fetch(PDO::FETCH_ASSOC);                $this->id = $result['id'];        $this->firstname = $result['firstname'];        $this->lastname = $result['lastname'];   }      public function getFirstname(){        return $this->firstname;   }      public function getLastname(){        return $this->lastname;   }      public function getId(){        return $this->id;   }   //add set methods and others (like save/delete methods)} 
 
e poi la usi tipo così:
	Codice PHP:
	
//apro la connessione al database$db = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
$person = new Person();$person->setConnection($db);$person->load(1); //carico il record con id=1echo $person->getFistname().' '.$person->getLastname(); 
 
immagina da solo del perchè poi si usino dei frameworks per fare queste cose 
EDIT: vabbeh sto editor de mer*a mi sformatta il codice, rimettitelo a posto