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 9208645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:39:39+00:00 2026-06-18T00:39:39+00:00

I am converting a php script which contains mysql_* functions to PDO. i want

  • 0

I am converting a php script which contains mysql_* functions to PDO.

i want to dislay all the sql related errors in my old script but i noticed that wherever there is an error in the sql syntax, php will output a blank page even if error reporting is turned on. Also the error is not logged in the log file.

If i use mysql_error() function at the end of the script which contains multiple sql queries, then the errors reported by the individual sql queries will be overwritten and only the last created error will be displayed.

So my question is instead of using die() or mysql_error() functions at the end of each and every sql query, is there a way by which i can view all the errors in the script at once?

i am using PHP version 5.3.8 and mysql version 5.5.

  • 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-06-18T00:39:40+00:00Added an answer on June 18, 2026 at 12:39 am

    So my question is instead of using die() or mysql_error() functions at
    the end of each and every sql query, is there a way by which i can
    view all the errors in the script at once?

    This is not recommended. Because instead of stopping the script (usually at the critical point) it would continue execution.

    However if you really need this, you can keep all SQL errors in some container, for instance, like, $errors array. It would look like this (procedural code) :

    <?php
    
    $errors = array();
    
    if ( ! mysql_query("SOME INVALID QUERY") ){
    
        array_push($errors, mysql_error());
    }
    
    
    if ( ! mysql_query("SOME ANOTHER INVALID QUERY") ){
       array_push( $errors, mysql_error() );
    }
    
    //lot of code
    //.....
    
    print_r( $errors );
    

    error_reporting and display_errors they both have nothing to do with SQL errors, but PHP engine itself. They won’t show any SQL error.

    And also, as usual, stop using mysql_* functions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JS script which im converting the code over to PHP but
I am writing a Greasemonkey script in which in one place I'm converting all
When converting a MongoCursor to PHP I use this script. Which was presented here
I'm converting a PHP script as DB has been switched from MySQL to PostgreSQL.
What is the php script for converting a mysql table to text file? I
I am converting an encryption script from PHP to JavaScript and am struggling... The
I am converting a script from PHP to ASP.net C#. In PHP, i could
I am converting a look-up table in PHP which looks like this to JavaScript
I have a script in kohana which runs fine on php 5.2.11. I took
Please refer to the following code, which grabs some information from a PHP script,

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.