0
I have Database called form, and a single table n_agreements.
i need to display form information in a table. I’m unable to connect to database.
<?php
$conn = mysqli_connect("localhost","root","","formulario");
$sql = 'SELECT * FROM formulario';
$resultado_formulario = mysqli_query($conn ,$sql);
if($sql === FALSE) {
die(mysqli_error());
}
while($row = mysqli_fetch_assoc($resultado_formulario)) {
echo $row['n_acordos'];
}
mysqli_close($conn);
?>
<p style="text-align:center"><strong><span style="font-size:120px">
<span style="font-family:arial,helvetica,sans-serif">
<span style="color:#FFFF00">
<span style="background-color:#000000">ACORDOS FORMALIZADOS</span></span></span></span></strong></p>
<table align="center" border="1" cellpadding="1" cellspacing="1" style="width:450px">
<tbody>
<tr>
<td rowspan="4" style="text-align:center"><strong><span style="color:#FFFFFF"><span style="font-size:450px"><span style="background-color:#000000"><?php $ntotalacordos=$_POST["f_total"]; echo $_POST['f_total']; ?></span></span></span></strong></td>
<td colspan="2" style="text-align:center"><span style="color:#000000"><em><strong><span style="font-size:180px">Consultor</span></strong></em></span></td>
</tr>
<tr>
<td style="text-align:center"><span style="color:#FF0000"><strong><span style="font-size:100px"><?php $ultimo=$_POST["f_ultimo"]; echo $_POST['f_ultimo'];
?></span></strong></span></td>
<td><span style="font-family:tahoma,geneva,sans-serif"><strong><span style="color:#FFFFFF"><span style="font-size:110px"><span style="background-color:#000000"><?php $consultor1=$_POST["f_consultor1"]; echo $_POST['f_consultor1']; ?></span></span></span></strong></span></td>
</tr>
<tr>
<td style="text-align:center"><span style="color:#FF0000"><strong><span style="font-size:100px"><?php $penultimo = $_POST["f_penultimo"]; echo $_POST['f_penultimo']; ?></span></strong></span></td>
<td><span style="font-family:tahoma,geneva,sans-serif"><strong><span style="color:#FFFFFF"><span style="font-size:110px"><span style="background-color:#000000"><?php $consultor2=$_POST["f_consultor2"]; echo $_POST['f_consultor2']; ?></span></span></span></strong></span></td>
</tr>
<tr>
<td style="text-align:center"><span style="color:#FF0000"><strong><span style="font-size:100px"><?php $antepenultimo=$_POST["f_antepenultimo"]; echo $_POST['f_antepenultimo']?></span></strong></span></td>
<td><span style="font-family:tahoma,geneva,sans-serif"><strong><span style="color:#FFFFFF"><span style="font-size:110px"><span style="background-color:#000000"><?php $consultor3=$_POST["f_consultor3"]; echo $_POST['f_consultor3']; ?></span></span></span></strong></span></td>
</tr>
</tbody>
</table>
<p style="text-align:center"><strong><span style="font-size:80px"><span style="font-family:arial,helvetica,sans-serif"><span style="color:#FFFF00"><span style="background-color:#000000">TOTAL DE PARCELAS</span></span></span></span></strong></p>
<p style="text-align:center"><span style="font-family:arial,helvetica,sans-serif"><span style="font-size:180px"><span style="background-color:rgb(0, 0, 0)"><strong><span style="color:#FFFFFF"> R$<?php $consultor3=$_POST["f_valor"]; echo $_POST['f_valor']; ?></span></strong></span></span></span></p>
What mistake you’re making?
– Alvaro Alves
Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in C: xampp htdocs send receives.php on line 8
– Cássio Bruno Sousa Ribeiro
This error happens because your object
$conn
was not initialized correctly– Alvaro Alves