On Thu, December 20, 2007 1:54 pm, George Pitcher wrote:
> I have a functions file with over 400 functions (and that may be too
> many -
> but it works). I've been adding some error reporting in to my PEAR::DB
> queries, but wanted to know which page triggered the function. I went
> theough my php pages and gane each one a $pg variable at the start
> containing the bare name of the file, eg 'home' rather than
> 'home.php'. I
> then went to each function containing either a DB query (ore one which
> calls
> another DB-related function. I did a global search and replace for the
> function name 'func(' replaced by 'func($pg,'. I use Dreamweaver so
> this was
> fairly straightforward.
>
> It worked for me, but now someone is about to show me a quicker,
> cleaner
> way, aren't they?

FIRST LINES OF CODE:
<?php
  function error_handler($code, $message, $file, $line, $context){
    die("ERROR: $message ($code) in $file:$line");
  }
  set_error_handler('error_handler');
?>

Anywhere else in your code:
[examples]

$connection = mysql_connect(...) or trigger_error("No DB access.",
E_USER_ERROR);


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to