This question has already been answered:
Hello. I am writing a script in php, which, at the user's request, displays a list of documents, 10 per page, everything is OK, everything works. But if you specify in the request what is not, it gives this error.
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given the very code of this type
$query = "SELECT * FROM `nal` WHERE `name`LIKE \"%$search%\" AND `remainder` > 0 ORDER BY `id` DESC LIMIT $start_from, $on_page"; $res = mysql_query($query); while ($row = mysql_fetch_assoc($res)) { As I understand it, $ res returns the value False, and therefore further and the error gets out, how to fix it correctly. Add if before while? I tried to just write before this that if false to print echo, there are no results and exit, but he brought me both a message and an error.