What's the best way to locate errors?
Posted: Sat Mar 04, 2006 5:15 pm
What is the best way to track errors in the following situation?
I have 8 classes, all of them use a 9th (database) class for handling mySQL queries. When I get a mySQL error, the script tells me on which line the error occured on the database class file, but this doesn't help me since it's always just the line in the database class that executes queries. I need to know in which method in which class the query passing through the database class originated. I can't figure out how to do this. Is there a good/standard way of handling this? Thanks in advance.
In case I explained this poorly, I've included an example below:
class.test.php:
class.test1.php:
class.test2.php:
If a mySQL error occurs, how can I tell if the query originated in SomeFunction() or AnotherFunction() ? Thanks.
I have 8 classes, all of them use a 9th (database) class for handling mySQL queries. When I get a mySQL error, the script tells me on which line the error occured on the database class file, but this doesn't help me since it's always just the line in the database class that executes queries. I need to know in which method in which class the query passing through the database class originated. I can't figure out how to do this. Is there a good/standard way of handling this? Thanks in advance.
In case I explained this poorly, I've included an example below:
class.test.php:
Code: Select all
class test {
...
function Query($query) {
$result = mysql_query($query);
}
...
}Code: Select all
class test1 extends test {
...
function SomeFunction() {
...
parent::Query($query);
...
}
...
}Code: Select all
class test2 extends test {
...
function AnotherFunction() {
...
parent::Query($query);
...
}
...
}