public function verificaCpf(Cliente $objCliente) { $conexao = $this->abreConexao(); $sql = "SELECT * FROM " . TBL_CLIENTES . " WHERE cpf = '" . $objCliente->getCpf() . "'"; $banco = $conexao->query($sql); $numLinhas = $banco->num_rows; return $numLinhas; $this->fechaConexao(); }
/** * Realiza o cadastro de um cliente novo * @param Cliente $cliente */ public function novo(Cliente $cliente) { $query = "INSERT INTO clientes (" . "senha, nome, cpf, email, ddd_telefone, " . "telefone, ddd_celular, celular, data_cadastro) " . "VALUES (:senha, :nome, :cpf, :email, " . ":ddd_telefone, :telefone, :ddd_celular, :celular, :data_cadastro" . ")"; $stmt = $this->conexao->prepare($query); $stmt->bindValue(":senha", $cliente->getSenha(), PDO::PARAM_STR); $stmt->bindValue(":nome", $cliente->getNome(), PDO::PARAM_STR); $stmt->bindValue(":cpf", $cliente->getCpf(), PDO::PARAM_STR); $stmt->bindValue(":email", $cliente->getEmail(), PDO::PARAM_STR); $stmt->bindValue(":ddd_telefone", $cliente->getDddTelefone(), PDO::PARAM_STR); $stmt->bindValue(":telefone", $cliente->getTelefone(), PDO::PARAM_STR); $stmt->bindValue(":ddd_celular", $cliente->getDddCelular(), PDO::PARAM_STR); $stmt->bindValue(":celular", $cliente->getCelular(), PDO::PARAM_STR); $stmt->bindValue(":data_cadastro", $cliente->getDataCadastro(), PDO::PARAM_STR); $stmt->execute(); // pega o Ășltimo id inserido return $this->conexao->LastInsertId(); }