/** * consulta_eleitor * Consulta todos dados eleitor * * @author João Paulo Bastos <jpbl.bastos at gmail dot com> * @return boolean [status da consulta] */ private function consulta_eleitor() { /* inicializa sql */ $this->sql = ''; $colun = ''; /* Contém o nome da coluna */ $data = ''; /* Armazena a linha consultada */ /* prepara sql */ $this->sql = "SELECT nome, sobrenome, email, idade, idcidade_cidade FROM eleicao.eleitor WHERE eleitor.ideleitor = '" . $this->get_dado('ideleitor') . "';"; /* Trabalhando com a base de dados */ if (!$this->db->open()) { $this->erro_msg = $this->db->erroMsg; return false; } if (!$this->db->query($this->sql)) { $this->erro_msg = $this->db->erroMsg; return false; } /* Recebe matriz de dados e percorre preenchendo os atributos da classe */ $data = $this->db->fetch(); $i = 0; while ($i < $this->db->num_fields()) { $colun = $this->db->fetch_field($i); $this->set_dado($colun->name, $data[$colun->name]); $i++; } $this->db->close(); /* Finalizando com o banco */ return true; }