5
I made a php to list the rooms, but I’m having difficulty to list them, if anyone can help me, I would appreciate
<?php
$link = mysqli_connect("localhost","root","","hotel");
$result = mysqli_query("SELECT descricao FROM quartos WHERE nome_quarto=Quarto Ibiza");
$row = mysqli_fetch_array($result);
?>
<table class="table table-bordered">
<tr>
<th class="tg-031e" colspan="3"></th>
</tr>
<tr>
<td class="tg-031e"><img src="fotos/ibiza.jpg" height="300px"></td>
<td class="tg-031e">
<b><font size="5px" color="black">Descrição:</font></b>
<p><font color="black" size="3px">
<!-- Mostrar os dados que fui buscar ao select -->
<?php
echo $row['descricao'];
?>
</p></font>
<button type="submit" id="button1id" name="button1id" style="border:3px double black;" class="btn btn-primary" >Reservar</button>
</td>
</tr>
</table>
Mistakes:
Warning: mysqli_query() expects at least 2 Parameters, 1 Given in F: XAMPP htdocs Pap2 quarto.php on line 67
Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, null Given in F: XAMPP htdocs Pap2 quarto.php on line 69
Please place your code here, removing sensitive information that could compromise your system. Only the code that contains the problem and relevant parts. So we can help you better.
– KaduAmaral
already this, can help pfv
– Odacil
What’s the problem? string values need simple quotes in sql.
– rray
To put the code, next time, select all your code and press the button with the "{}" icon. Or, put four spaces before each line. This is important especially with codes starting
<?
, because that’s what the text formatting engine interprets as the beginning of an invisible text.– Victor Stafusa