+ 1
php
<div class="search"> <form name="f1" method="post" action="search.php"> <input type="search" name="search_q"/> <input type="submit" value="Поиск"/> </form> </div> <?php $search_q=$_POST['search_q']; $l= mysqli_connect('localhost', 'root', '12345', 'hova'); $search_q = trim($search_q); $search_q = strip_tags($search_q); $q= mysqli_query($l, "SELECT * FROM hova WHERE LIKE '%$search_q%'"); $itog=mysqli_fetch_assoc($q); while ($itog = mysqli_fetch_assoc($q)) { printf("%s (%s)\n",$r["name"],$r["content"]); } mysqli_free_result($q); mysqli_close($l); ?> //gives an error message:Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given
2 ответов
+ 2
Use mysqli_num_rows() to get the results
+ 1
thank you