Jump to content

How to get the line beign exectued.


MadnessRed

Recommended Posts

is it possible to get the line where the current functino was exectued, eg

 

<?
function a($a = __LINE__){
    echo $a;
}

echo "This is line "; a(); //this will show the current line
?>

 

 

or in context

<?
function query($query){

mysql_query($query) or error($query,mysql_error(),__FILE__,__LINE__);
}

function error($q,$e,$f,$l){
mysql_query("INSERT INTO `errors` (`query`,`error`,`file`,`line`)
VALUES ('".$q."','".$e."','".$f."','".$l."');");
}
?>

sorry I can't edit for some reason, I have that, but it works fine for most errors except the sql ones, I have set it to mysql_query or trigger error but I jsut get the line of the function, not of where the function was defeined

 

is there something that I can return that will cause an error?,

 

eg

 

mysql_query() or return trigger_error();

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.