RE: [PHP] getting the line number
| From: | Chris W. Parker | Date: | Mon, 07 Jun 2004 19:06:58 +0000 |
| Subject: | RE: [PHP] getting the line number | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187829@lists.php.net to get a copy of this message | ||
Tim Traver <mailto:tt-list@simplenet.com>
on Monday, June 07, 2004 11:52 AM said:
> Is it possible to get the line number of the parent script of a
> subroutine ???
no, not like you want (afaik). i wanted this same thing too but ended up
just doing a workaround. it's a little kludgy but it's not *too* bad. i
just pass __LINE__ throughout all my db related functions.
(something like this)
$db = new Database;
$sql = "SELECT name FROM people";
$db->query($sql, __LINE__);
and $db->query() is setup so that when/if there is an error it will
print the line number.
hth,
chris.