Vikas Jayna Posted January 8, 2008 Share Posted January 8, 2008 I am trying to make a middle layer for interaction between the database and the applications Hence I created a function _db_query() that is to be called to execute any query throughout the application on our site. This function does some decision making about which server the query should go to. The function uses mysql_query() function then to execute the query on that server. The issue is that I need to restrict the use of mysql_query() function from anywhere else in the application and force them to use the function _db_query() so as to avoid mistakes in case a programmer forgets to call _db_query() and instead calls mysql_query() Any ideas about implementing this? Quote Link to comment https://forums.phpfreaks.com/topic/84998-restrict-call-to-mysql_query-function/ Share on other sites More sharing options...
trq Posted January 8, 2008 Share Posted January 8, 2008 I'm actually not sure it can be done. You cannot overide a function in php and while you can disable functions, that disables the function install wide. One thing you could do would be to hide the user/pass, making it impossible to connect to a database unless calling the _db_query function which would then also need to handle the connection. Quote Link to comment https://forums.phpfreaks.com/topic/84998-restrict-call-to-mysql_query-function/#findComment-433427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.