Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6362743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:56:54+00:00 2026-05-24T23:56:54+00:00

I am currently working on a PHP project with MySQL. I have the PHP

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:56:55+00:00Added an answer on May 24, 2026 at 11:56 pm

    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 the or die() part:

    echo 'Output something';
    $res = mysql_query($sql);
    if ($res) {
     /* do stuff with the query results */
    } else {
      /* output an error if desired... or don't */
      echo 'There was a database error: '.mysql_error();
    }
    echo 'Output some more stuff';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the project my team is currently working on, we're modifying a commercial PHP
I'm currently working on a PHP application that uses a MySQL database for its
I'm currently working on an OO PHP application. I have a class called validation
I am currently working on a small sponsorship application(PHP/MySql) for my personal blog, and
I am currently working on a web application that uses PHP and MySQL, but
I am currently working on a PHP project which includes extensive database usage. The
For the project I'm currently working on I have a database with locations (restaurants,
I am currently working on a php/javascript project which retrieves information from a database
I have an idea for a project that I am currently working on, I
I am currently working on a php project with the user of ajax. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.