[thelist] mySQL/PHP class function (maybe another stupid question)

Phil Turmel philip at turmel.org
Mon Jul 11 10:47:53 CDT 2005


Nan,

These are "magic" constants used for debugging:

http://www.php.net/manual/en/language.constants.predefined.php

If the query() method of the database class encounters trouble, it can 
generate an error message that includes the calling routine's filename 
and line number, just like a built-in error message.

If you have PHP 5, you can use the new exception handler interface, 
which includes access to the entire backtrace when an exception is 
thrown.  A lot neater than sticking __FILE__ and __LINE__ into every 
class method.  Details here:

http://www.php.net/manual/en/language.exceptions.php

HTH,

Phil


Nan Harbison wrote:
> Hello,
> 
> I am still slogging through thousands of lines of code I didn't write try to
> find the bugs in the code that makes the website not function as it is
> supposed to.
> In the database class (which mainly makes it easier to switch the type of DB
> being used), there is the funtion:
> 
> function query($query, $file="", $line="", $type=DB_TYPE)
> 
> and when this function is called, the call looks like this:
> 
> if ($r = $this->db->query($q, __FILE__, __LINE__))
> 
> so what the heck are these:
> 
> __FILE__
> and
> __LINE__
> 
> I am completely lost on this. Sorry if this is a stupid question.
> 
> TIA,
> Nan
> 
> 




More information about the thelist mailing list