public function delete(JuradoPopular $jPop) { $stmt = $this->db->query("SET FOREIGN_KEY_CHECKS=0"); $stmt = $this->db->prepare("DELETE from juradoPopular WHERE id_usuario=?"); $stmt->execute(array($jPop->getId())); $stmt = $this->db->query("SET FOREIGN_KEY_CHECKS=1"); $stmt = $this->db->prepare("DELETE from usuario WHERE id_usuario=?"); $stmt->execute(array($jPop->getId())); }
public function votar(Codigo $cod, JuradoPopular $jpop) { $stmt = $this->db->prepare("INSERT INTO vota_pop values(?,?)"); $stmt->execute(array($jpop->getId(), $cod->getId())); $stmt2 = $this->db->prepare("UPDATE pincho set num_votos=(num_votos + 1) where FK_establecimiento_pinc=?"); $stmt2->execute(array($cod->getEstablecimiento())); }