Re: Function that outputs "at line xxx"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeah, I understand what your asking. I don't know of any method to get the
line number a function was called on, from within the function.

You may have to pass __LINE__ and __FILE__ in your db_query() function, or
whatever it is.

---John Holmes...

----- Original Message -----
From: "Peter Beckman" <beckman@purplecow.com>
To: "1LT John W. Holmes" <holmes072000@charter.net>
Cc: <php-db@lists.php.net>
Sent: Wednesday, October 23, 2002 3:26 PM
Subject: Re:  Function that outputs "at line xxx"


> John, that does work!  Thanks.
>
> The problem is this:
>
> Database calls are in db.inc.  The script problem occurs in wine.inc.
> True, the SQL is called and executed from db.inc, so __LINE__ and __FILE__
> are correct in a way.  But how do I find out where in the execution of my
> script the other files are in their execution?
>
> index.php --> calls function in
>     wine.inc --> calls function in
>         db.inc --> throws SQL error, calls function in
>     wine.inc --> which prints error to user nicely and exits
>
> What I want is when db.inc throws the error and passes the error text to
> the db_error function in wine.inc to look pretty for the user, I want to
> know where the function db_query was called in wine.inc (one level up, the
> script which called the function now running).
>
> Is this possible?  Does it exist?
>
> Peter
>
> On Wed, 23 Oct 2002, 1LT John W. Holmes wrote:
>
> > __LINE__ and __FILE__ should work.
> >
> > ---John Holmes...
> > ----- Original Message -----
> > From: "Peter Beckman" <beckman@purplecow.com>
> > To: <php-db@lists.php.net>
> > Sent: Wednesday, October 23, 2002 3:00 PM
> > Subject:  Function that outputs "at line xxx"
> >
> >
> > > Hey --
> > >
> > > I'm writing a database error handler function in PHP, and I want it to
> > tell
> > > me at what line in what script the error occurred.  Is this possible?
I
> > > know it happens when PHP hits a warning or a fatal error, but is it
> > > possible to do in a live script?  Or is there a global variable which
> > keeps
> > > track of what line in which scripts each execution is at?
> > >
> > > Thanks,
> > > Peter
> >
> --------------------------------------------------------------------------
> > -
> > > Peter Beckman            Systems Engineer, Fairfax Cable Access
> > Corporation
> > > beckman@purplecow.com
> > http://www.purplecow.com/
> >
> --------------------------------------------------------------------------
> > -
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --------------------------------------------------------------------------
-
> Peter Beckman            Systems Engineer, Fairfax Cable Access
Corporation
> beckman@purplecow.com
http://www.purplecow.com/
> --------------------------------------------------------------------------
-
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux