Error Handling
Error handling, which is important in any script, is even more of an issue when dealing with databases since the probability for errors will increase dramatically. Common errors you will encounter are
Failure in connecting to a database
Failure in selecting a database
Inability to run a query
No results being returned by a query
Experience will teach you why these errors normally occur, but immediately seeing what the problem is when running your scripts can save you much debugging time. To have your scripts give informative reports about errors that occur, you make use of the mysql_error() and mysql_errno() functions. The former will print a textual version of the error that MySQL returned and the latter will return the corresponding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access