How to mysqli prepared statements error reporting in php?

All of the mysqli functions return false on failure, so you could easily just check for truthiness on each function and report errors.

How to display error without alert box using javascript ?

Errors in JavaScript can be displayed without the use of alert boxes but using the alert box is the traditional way to do that. We can show errors with two methods without using the alert box.