magnogcs 0 Denunciar post Postado Novembro 5, 2015 Bom pessoal, estou criando meu primeiro banco com php com parametros mysqli e sempre que concerto um erro, ocorre outro diferente, estou empacado e gostaria da ajuda de vocês. O erro em questão é: Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\Apache24\htdocs\prematricula.php on line 39Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given in C:\Apache24\htdocs\prematricula.php on line 40 Se houverem outras coisas a serem corrigidas podem informar também. Scripts: (prematricula.html) <html> <head> <title>Cadastro pre matricula</title> </head> <body> <form name="signup" method="post" action="prematricula.php"> <h2> <center><font face="geosanslight">Cadastro de pré-Matricula </h2> <h4> <center><font face="geosanslight">Preencha o formulário</h4> <p><font face="geosanslight"> Nome: <input type=text name="nome" size="30" maxlenght="50"></p> <p><font face="geosanslight"> Data de nascimento: <input type=text name="nascimento" size="5" maxlenght="10" </p> <p><font face="geosanslight"> Sexo: <br>Masculino <input type=radio name="sexo" value="Masculino" checked> Feminino<input type=radio name="sexo" value="Feminino"</p> <p><font face="geosanslight"> Endereço: <input type=text name="endereco" size="20" maxlenght="200"</p> <p>Referencia: <textarea name="referencia" rows="2" cols="40"></textarea></p> <p><font face="geosanslight"> RG: <input type=text name="rg" size="10" maxlenght="20"</p> <p><font face="geosanslight"> Informe a série a ser mátriculado: <select name="serie"> </p> <option> 1 Ano <option> 2 Ano <option> 3 Ano <option> 4 Ano </select> <p><font face="geosanslight"> <input type=submit name="enviar" value="Enviar"> <font face="geosanslight"> <input type=reset value="Limpar"> </form> </body> </html> (prematricula.php) <html> <head> <title>teste</title> </head> <body> <?php $db = "pre_matricula"; $dblocal = "localhost"; $dbuser = "root"; $dbpass = "123456"; $conexao = mysqli_connect($dblocal,$dbuser, $dbpass, $db); if (mysqli_connect_errno()) { die("Falha na conexão com o servidor MySQL! ".mysql_connect_error()); exit(); } ?> <?php $_SESSION["nome"] =$nome =$_POST['nome']; $_SESSION["nascimento"]= $nascimento=$_POST['nascimento']; $_SESSION["sexo"]= $sexo=$_POST['sexo']; $_SESSION["endereco"]= $endereco=$_POST['endereco']; $_SESSION["referencia"]= $referencia=$_POST['referencia']; $_SESSION["rg"]= $rg=$_POST['rg']; $_SESSION["serie"]= $serie=$_POST['serie']; ?> <?php $sql = "INSERT INTO 'aluno' ( nome, nascimento, sexo, endereco, referencia, rg, serie) VALUES (?,?,?,?,?,?,?)"; $stmt = $conexao->prepare($sql); $stmt = mysqli_stmt_bind_param($stmt, 'sssssss', $_SESSION["nome"],$_SESSION["nascimento"], $_SESSION["sexo"],$_SESSION["endereco"], $_SESSION["referencia"],$_SESSION["rg"], $_SESSION["serie"]); if (mysqli_stmt_execute($stmt)); { echo "Seu cadastro foi realizado com sucesso!Agradecemos a atenção."; } ?> Compartilhar este post Link para o post Compartilhar em outros sites
Lucas Guima 164 Denunciar post Postado Novembro 5, 2015 Quando postar código, utilize a tag de código. E é só ler o seu erro, está dizendo o problema... Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given inC:\Apache24\htdocs\prematricula.php on line 39 Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given inC:\Apache24\htdocs\prematricula.php on line 40 Compartilhar este post Link para o post Compartilhar em outros sites
magnogcs 0 Denunciar post Postado Novembro 5, 2015 Quando postar código, utilize a tag de código. E é só ler o seu erro, está dizendo o problema... Fiz a edição para código. A linha 39 é a $_SESSION["serie"]); O que eu faço para corrigir? Compartilhar este post Link para o post Compartilhar em outros sites
Lucas Guima 164 Denunciar post Postado Novembro 5, 2015 Leia o erro, o problema tá na função, não na variável. Compartilhar este post Link para o post Compartilhar em outros sites