A lo que me refiero es algo así
Código PHP:
Ver original<?php
class classConnectDb{
private $mysql_host;
private $mysql_user;
private $mysql_pass;
private $mysql_db;
protected $connect_db;
public function __construct($host, $user, $pass, $db){
$this->mysql_host = $host;
$this->mysql_user = $user;
$this->mysql_pass = $pass;
$this->mysql_db = $db;
}
public function connectDb(){
}
}
class query extends classConnectDb{
protected $mysql_query;
public function __construct($host, $user, $pass, $db){
parent::__construct($host, $user, $pass, $db);
}
public function query($query){
}
}
class fetch extends query{
public function __construct($host, $user, $pass, $db){
parent::__construct($host, $user, $pass, $db);
}
public function fetchQuery(){
}
}
$obj = new fetch('hostname','username','password','database');
$obj->connectDb();
$obj->query('SELECT * FROM tabla');
while($row = $obj->fetchQuery()){
}