public function DeletarDAO($id) { $this->_conexao = ConectaComBanco(); $statement = $this->_conexao->prepare("DELETE FROM tb_categoria WHERE id = ?"); $statement->bind_param('i', $id); $statement->execute(); desconectaDoBanco($this->_conexao); }
public function GetAtendenteDAO($idChamado) { $result = mysqli_query($this->_conexao, "SELECT id_atendente FROM tb_chamado WHERE id = " . $idChamado); $this->usuario = new Usuario(); if ($result) { while ($r = $result->fetch_assoc()) { return $this->usuario->getUserById($r['id_atendente']); } } desconectaDoBanco($this->_conexao); }
public function AlterarSenhaDAO($login, $senha) { $stmt = $this->_conexao->prepare("UPDATE tb_usuario SET senha = ? WHERE login = ?"); $stmt->bind_param('ss', $senha, $login); $stmt->execute(); return $this->_conexao->insert_id; desconectaDoBanco($this->_conexao); }
public function GetTotalDiasHouveramHelpdeskDAO() { $this->_conexao = conectaComBanco(); $sqlStr = "select count(data) dias from (\n\t\t\t\t\t\tselect distinct\n\t\t\t\t\t\t\tdate(resposta.data) as data\n\t\t\t\t\t\tfrom \n\t\t\t\t\t\t\ttb_chamado chamado\n\t\t\t\t\t\t\tleft join tb_resposta_chamado resposta on resposta.id_chamado = chamado.id\n\t\t\t\t\t\twhere\n\t\t\t\t\t\t\tresposta.id = (select min(id) from tb_resposta_chamado where id_chamado = chamado.id)\n\t\t\t\t\t\tlimit 100\n\t\t\t\t\t) tb_chamado"; $result = mysqli_query($this->_conexao, $sqlStr); if ($result) { while ($r = $result->fetch_assoc()) { $totalHora = $r['dias']; } } desconectaDoBanco($this->_conexao); return $totalHora; }