jakebur01 Posted August 28, 2007 Share Posted August 28, 2007 is their any way to find out "localhost" of mysql to get the actual address? If not, is their any way to pull the content of a table off of localhost and connect to mysql on another server and insert the data into a table there? Quote Link to comment https://forums.phpfreaks.com/topic/67115-solved-finding-out-localhost/ Share on other sites More sharing options...
php_tom Posted August 28, 2007 Share Posted August 28, 2007 is their any way to find out "localhost" of mysql to get the actual address? I don't entirely understand your question but this may help: $_SESSION['SERVER_NAME'] contains the name of the server the script is running on. So this could be 'localhost' or 'myDomain.com' or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/67115-solved-finding-out-localhost/#findComment-336591 Share on other sites More sharing options...
jakebur01 Posted August 28, 2007 Author Share Posted August 28, 2007 like this? <?php session_start(); $test= $_SESSION['SERVER_NAME']; echo $test; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67115-solved-finding-out-localhost/#findComment-336649 Share on other sites More sharing options...
php_tom Posted August 28, 2007 Share Posted August 28, 2007 $_SESSION['SERVER_NAME'] AAAACCCKKKKK!!! I just wasn't thinking... What I meant was: $_SERVER['SERVER_NAME'] So yeah you can do something like: <?php $test= $_SERVER['SERVER_NAME']; if($test=="myDomain.com") { // Link to one SQL server here } elseif($test=="localhost") { // Link to localhost SQL server } else { // Link to some other SQL server... } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67115-solved-finding-out-localhost/#findComment-336705 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.