Answer the question
In order to leave comments, you need to log in
How to do a search?
there is a code:
<?php
$search_q=$_POST['search_q'];
$l= mysqli_connect('localhost', 'Логин', 'пароль', 'БД');
$search_q = trim($search_q);
$search_q = strip_tags($search_q);
$q= mysqli_query($l, "SELECT name,author FROM `book` WHERE name LIKE '%$search_q%'");
$itog=mysqli_fetch_assoc($q);
while ($itog = mysqli_fetch_assoc($q)) {
printf("%s (%s)\n",$r["name"],$r["author"]);
}
mysqli_free_result($q);
mysqli_close($l);
?>
Answer the question
In order to leave comments, you need to log in
printf("%s (%s)\n",$r["name"],$r["author"]);
Where is your variable defined with the name $r
? That's right - nowhere, that's why everything falls. $itog['name']
should be. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question