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

  • Home
  • SEARCH
  • 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 6552529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:28:12+00:00 2026-05-25T12:28:12+00:00

Instead of sending queries to PHPs mysql_query() function I currently send my queries to

  • 0

Instead of sending queries to PHPs mysql_query() function I currently send my queries to a custom wrapper sql_query(), which, amongst other things does the “mysql_query” part.

The problem with this setup is that when there’s an SQL error the file and the line number are where the sql_query() function is located, rather then where the actual SQL query is.

Is there a way of having PHP report the file and linenumber of where sql_query() is called from, rather than where the mysql_query() function actually is?

  • 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-25T12:28:13+00:00Added an answer on May 25, 2026 at 12:28 pm

    debug_backtrace

    And many helpful example there for your problem. One of this.
    Surprisingly, no one has described one of the best uses of this: dumping a variable and showing the location. When debugging, especially a big and unfamiliar system, it’s a pain remembering where I added those var dumps. Also, this way there is a separator between multiple dump calls.

    <?php
    
    function dump( $var ) {
         $result = var_export( $var, true );
         $loc = whereCalled();
         return "\n<pre>Dump: $loc\n$result</pre>";
     }
    
     function whereCalled( $level = 1 ) {
         $trace = debug_backtrace();
         $file   = $trace[$level]['file'];
         $line   = $trace[$level]['line'];
         $object = $trace[$level]['object'];
         if (is_object($object)) { $object = get_class($object); }
    
         return "Where called: line $line of $object \n(in $file)";
     }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to send an email and instead of sending 5 individual emails to
I currently have two anchor tags sending url queries to put votes inside a
Can i send object or bean instead of sending parameters in jsp request to
I need to query mysql db with about 3000 queries, instead sending each query
Instead of sending a MessageBox to the user I would like to send a
Instead of relying on my host to send an email, I was thinking of
I have read about the true messaging and that instead of sending payload on
I have an action which causes an exception in my staging environment, but instead
I am sending queries to a very large database (meaning many entities/tables). So I
Possible Duplicate: C sizeof a passed array instead of sending the sizeof: void main()

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.