Your
PHP: mysqli::query - Manual[
^] call failed:
Quote:
Return Values
Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.
It is always a good idea to check return values and display error messages upon errors to know what went wrong:
if ($result = mysqli_query($con,$sql)) {
}
else {
printf("Error: %s\n", mysqli_error($con));
}
In your case it is probably a syntax error in the query string. As far as I know, MySQL does not know the
TOP
command. You have to use
LIMIT
instead:
$sql = "SELECT complainno FROM complain LIMIT 1";