I am facing a problem. So I thought I should post my question here. I want to know that if my query is invalid how can I code the query so that the PHP controller notify me about the query error. Here is my PHP query code.
//assuming that the link $link to sql db has been already made
$Result = mysqli_query($link, 'SELECT * FROM books-table');
Is it possible to get notified whenever the query is wrong? please help
There is a simple way to do it. You can add an
if conditionto your code and usemysqli_errorfunction to notify you about the invalid queries. Also you should save the query in a variable if you want to echo it easily so that you can also see the query. Here is your code with changes:Hope it will help you.