Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TabelaDAO extends PDOConnectionFactory {
- // irá receber uma conexão
- public $conex = null;
- // constructor
- public function TabelaDAO(){
- $this->conex = PDOConnectionFactory::getConnection();
- }
- public function getCamposByIdTabela($id, $inicio, $fim, $order){
- try{
- if(!$order){
- $order = 'campos';
- }
- $limit = $this->getLimitSql($inicio,$fim);
- $stmt = $this->conex->query("SELECT Campos
- FROM tabela1 a, tabela2 b where a.id_tabela = b.id_tabela and b.id_tabela = $id order by $order $limit");
- $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
- // desconecta
- $this->conex = null;
- // retorna o resultado da query
- return($result);
- }catch ( PDOException $ex ){ echo "Erro: ".$ex->getMessage(); }
- }
- }
Add Comment
Please, Sign In to add comment