The Letter E Posted April 1, 2011 Share Posted April 1, 2011 Perhaps this is a rather lay question, but, is there a way to gather specific connection details about an open MySQL connection in php? Example: <?php $connect = mysql_connect('localhost', 'username', 'password'); ?> Using the $connect variable, could I run a command that dumps the host, and username to a log file?? Thanks in advance, I'm still searching. E Quote Link to comment Share on other sites More sharing options...
j9sjam3 Posted April 1, 2011 Share Posted April 1, 2011 Just out of curiosity, why would you want to do that? Aren't you defining the host, user etc anyway? Quote Link to comment Share on other sites More sharing options...
The Letter E Posted April 1, 2011 Author Share Posted April 1, 2011 Just out of curiosity, why would you want to do that? Aren't you defining the host, user etc anyway? This is going into an object that will be managing multiple connections. Quote Link to comment Share on other sites More sharing options...
j9sjam3 Posted April 2, 2011 Share Posted April 2, 2011 Couldn't you just use a function to connect (function conn($hosst, $user, $pass etc)) and log from that? Quote Link to comment Share on other sites More sharing options...
SamT_ Posted April 2, 2011 Share Posted April 2, 2011 Using a connection resource, you cannot extract any of the connection details. This is a security feature as you don't want your database info available if you don't need it. Quote Link to comment 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.