I am currently working on a PHP project with MySQL. I have the PHP tag at the top and bottom of the page to start and end the PHP. In between the PHP tags I am opening an echo statement output HTML to the browser. In parts of the page where I need to perform PHP, I end the echo tag and perform a MySQL Query using
mysql_query($myQuery) or die("Error");
When the MySQL has an error, it stops at that point and the rest of the HTML isn’t shown which obviously affects the design of the page.
How can I get the HTML part to continue if the MySQL fails to run.
An example of your code would be useful, but in general, the
mysql_query() or die()pattern is not necessary. If you don’t want execution to halt upon the failure of a given query, simply omit theor die()part: