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? 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. 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; ?> 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... } ?> Link to comment https://forums.phpfreaks.com/topic/67115-solved-finding-out-localhost/#findComment-336705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.