|
Posted by paranic on 07/12/06 10:37
Hi there
i suppose we have the following class
file database.php
class InSQL
{
function query($query, $link_identifier=null)
{
global $query_totals;
$query_start = microtime(true);
$return = mysql_query($query, $link_identifier);
$query_stop = microtime(true);
$query_totals[] = ($query_stop - $query_start);
return $return;
}
}
i call the query from another file
file sample.php
$result = InSQL::query($sql, $localdb);
when a mysql error occur php reports mysq error at file database.php
line x.
i whant without modifing the form of calling the queryies to display
the correct error with the caller file and the caller line.
one solution is to modify the calling line to $result =
InSQL::query($sql, $localdb, __FILE__, __LINE__);
so if an error occur i will have the file and line where i called the
query. but i dont whant to make the query calling line so complicated.
the other solution is to change the query function as folows:
function query($query, $link_identifier=null, $file=__FILE__,
$line=__LINE__)
and call the query as always, but this reports the database.php file
and the function query() line.
is there any way to have correct error reporting without printing the
query on the browser and without modifing the way i call the query
function?
Thanks in advance
Nikos
[Back to original message]
|