Re: Overriding core functions

From: Date: Tue, 22 Aug 2006 17:09:45 +0000
Subject: Re: Overriding core functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241024@lists.php.net to get a copy of this message
On Tue, August 22, 2006 6:39 am, Peter Lauri wrote: > > I want to add some functionality when calling the mysql_query(): > > function mysql_query($Query) { > > //do stuff before > > mysql_query($Query); > > //do things after > > } > > > > This would just be for one project where I want to record all Queries > and > the result of them, creating an own logging function. > > I did a lot of Google, but no article that I found that take care of > this > subject. The only was I know of to over-ride core functions, or, in this case, extension's functions, are to: A) alter PHP source and re-compile B) install the RunKit extension and be prepared for a wild ride PHP simply doesn't have the infrastructure for you to override the mysql_query() function as you want... You'd have to use my_mysql_query() or somesuch, and then always call that instead of the normal mysql_query. You might be able to attack this from the MySQL side of things. MySQL has a query logging facility which might be more amenable to what you want to achieve. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#241024) next »