1
I was making a system of comments, but is giving error:
Error in database Selected
Code:
<?php
$link=mysqli_connect("127.0.0.1","root","");
$banco=mysqli_select_db($link,"bdcomentario");
?>
<form name='form' method="post" action="#">
Nome:
<input type='text' name='nome'>
<br><br> E-mail:
<input type='email' name='email'>
<br><br>
Comentario:
<textarea name='coment'></textarea>
<br><br>
<input type='submit' value='Enviar'>
<input type="reset" value='Limpar'>
</form>
<?php
$nome=$_POST['nome'];
$email=$_POST['email'];
$data= date("d/m/Y");
$comentario=$_POST['coment'];
$st="INSERT INTO tbcomentarios(nome,email,data,coment)
values('$nome','$email','$data','$comentario')";
if(strlen($_POST['nome'])){
$insert= mysqli_query($link,$vrau);
}
$sql="SELECT * FROM tbcomentarios ORDER BY id desc";
$executar=mysqli_query($link, $sql)
or die("Error: ".mysqli_error($link));
while( $exibir=mysqli_fetch_assoc($executar)){
echo $exibir['data'];
echo '<br>';
echo $exibir['nome'];
echo '<br>';
echo $exibir['email'];
echo '<br>';
echo $exibir['coment'];
echo '<br>';
mysqli_free_result($executar);
}
mysqli_close($link);
?>