MadnessRed Posted February 7, 2009 Share Posted February 7, 2009 is there a way to find out the line currently being exectuded? So I can say, for example. mysql_query("SELECT * FROM $table") or die(mysql_error()."<br />Error on line: ".$line); Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2009 Share Posted February 7, 2009 http://us.php.net/manual/en/language.constants.predefined.php Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-756947 Share on other sites More sharing options...
MadnessRed Posted February 7, 2009 Author Share Posted February 7, 2009 thanks Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-756950 Share on other sites More sharing options...
MadnessRed Posted February 14, 2009 Author Share Posted February 14, 2009 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."');"); } ?> Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762276 Share on other sites More sharing options...
Mchl Posted February 14, 2009 Share Posted February 14, 2009 If you want to log errors to database, wouldn't it be better to create custom error handlers? Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762288 Share on other sites More sharing options...
MadnessRed Posted February 14, 2009 Author Share Posted February 14, 2009 If you want to log errors to database, wouldn't it be better to create custom error handlers? Yes, that would be great, I am gonna look that up, thanks. Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762292 Share on other sites More sharing options...
Mchl Posted February 14, 2009 Share Posted February 14, 2009 See set_error_handler Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762293 Share on other sites More sharing options...
MadnessRed Posted February 14, 2009 Author Share Posted February 14, 2009 See set_error_handler ok, so how do I pass me own info into the error handler? Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762299 Share on other sites More sharing options...
MadnessRed Posted February 14, 2009 Author Share Posted February 14, 2009 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(); Link to comment https://forums.phpfreaks.com/topic/144241-how-to-get-the-line-beign-exectued/#findComment-762318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.