fileA.php: requires function.inc.php and uses x()
from that include file
fileB.php: requires fileA.php User invokes fileB.php to get fileA.php
function.inc.php: function x()
- returns filename that invoked it
What is the PHP server variable or whatever that gets the name of fileA.php from within function.inc.php?
- Usecase - function x() could be a
mysql_query() or die(mail( {info about error as well as which file caused it} )
based on answer below - this works:
function x($q){
mysql_query($q) or die(mail('[email protected],'error @ '.$_SERVER['PHP_SELF'] , serialize(debug_backtrace()) . "\n\n".mysql_error()));
}
- for the person who voted this down - could you provide a better idea/solution for the function trace above?