predefined variables

From: Date: Fri, 09 Jun 2000 05:12:30 +0000
Subject: predefined variables
Groups: php.general 
Request: Send a blank email to php-general+get-1358@lists.php.net to get a copy of this message
Hi all, I am trying to write a function for use in a mysql generic database class that traps bad queries and saves tham to the database. It saves the bad query, and automatically generated error id#, and suppoedly the script that generated the error and the http request that was sent to the server. It is part of a class that I include from another file - the only problem is, I don't want to have to explicitly pass the name of the calling script, or the apache http variables. But, when I look at what gets saved, I see null strings for $PHP_SELF, $HTTP_SELF, and $REMOTE_ADDR but the rest of the error has been saved. Is there some kind of global declaration I can use, or am I just confused about the scope of those variables when the function is called from an included file? Anyone? function db_die($code) { $this->connect(); $query = "insert into errors (script, code, error_date) values ('$PHP_SELF', 'request($HTTP_REQUEST) from IP($REMOTE_ADDR): $code', ".mktime().")"; mysql_query($query, $this->link_id) or die("Could not die properly, $query!"); $error_num = mysql_insert_id($this->link_id); $this->close(); die ("Error: $error_num. Please email <mailto:\"evan@talksofa.com\">evan@talksofa.com with the error number"); } Thanks, Evan Raskob esr9@cornell.edu

« previous php.general (#1358) next »