Array
(
)

Por favor, me ajudem com esse erro Fatal error: Call to a member function prepare() on null in C:\xampp\htdocs\index.php on line 27

PHP
Wesley Jonas
   - 13 jan 2016

#Código

<?php require_once('conexao.php'); ?>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Cadastro</title>
</head>

<body>
<?php
require_once('Cliente.class.php');
	
	$nome  = trim(filter_input(INPUT_POST, 'nome'));
	$email = trim(filter_input(INPUT_POST, 'email'));
	$cpf   = trim(filter_input(INPUT_POST, 'cpf'));
	$nasc  = trim(filter_input(INPUT_POST, 'nasc'));
	$pass  = trim(filter_input(INPUT_POST, 'pass'));
	
	$cliente = new Cliente();
	$cliente->setNome($nome);
	$cliente->setEmail($email);
	$cliente->setCpf($cpf);
	$cliente->setNasc($nasc);
	$cliente->setPass($pass);
	
	$conexao = BD::conn();
	$inserir = $conexao->prepare('INSERT INTO cliente (nome, email, cpf, dataNasc, pass) VALUES(:nome, :email, :cpf, :nasc, :pass)');
	$inserir->bindValue(':nome',  $nome);
	$inserir->bindValue(':email', $email);
	$inserir->bindValue(':cpf',   $cpf);
	$inserir->bindValue(':nasc',  $nasc);
	$inserir->bindValue(':pass',  $pass);
	$inserir->execute();
?>

<form action="" method="post">
<br>
	Nome:<br><input type="text" name="nome"><br><br>
	E-mail:<br><input type="text" name="email"><br><br>
	CPF:<br><input type="text" name="cpf"><br><br>
	Nascimento:<br><input type="date" name="nasc"><br><br>
	Senha:<br><input type="password" name="pass"><br><br>
	
	<input type="submit" value="Cadastrar">
</form>
</body>
</body>
</html>

Nilton Braz
   - 13 jan 2016

Acessa esse link:

http://stackoverflow.com/questions/20882506/fatal-error-call-to-a-member-function-prepare-on-a-non-object-in-c-xampp-htd