title: How to connect to remote MYSQL database via php
body: <p>I have to build an android app which connects to a remote MYSQL webserver and retrieve information for display purpose.
  So I did research coz I had no idea where to start. I read an article it mentions the better approach for that is to use php script. And didn’t know anything about how server, database and php works, so I studied php from here “<a href="http://www.homeandlearn.co.uk/php/php12p1.html" rel="nofollow">http://www.homeandlearn.co.uk/php/php12p1.html</a>” to understand and downloaded WhampServer to do some testing. On local machine everything worked fine. 
  But main thing I don’t understand is “HOW TO CONNECT TO REMOTE SERVER/DATABASE”. 
  It’s obvious that I’m doing something really stupid, I just need help to find out what am I doing wrong. 
  When we test php script on local machine in webrowse we use "localhost/some.php." But when I want to test same php script on remoter server from my local machine then what and how should I do? Do I need to make some changes in configuration file on server side?
  I have done more research before asking this question here to understand remote server connection in php but I still don’t understand. I have gone through almost all the pages within the link below:
  <a href="https://www.google.co.uk/search?q=connect+to+remote+mysql+webserver+php&amp;rlz=1C1AVSX_enGB447GB448&amp;oq=connect+to+remote+mysql+webserver+php&amp;aqs=chrome.0.69i57j69i62l3.19724j0&amp;sourceid=chrome&amp;ie=UTF-8#fp=5a2359cf96dc5f79&amp;q=how+to+connect+to+remote+mysql+web+server+php" rel="nofollow">https://www.google.co.uk/search?q=connect+to+remote+mysql+webserver+php&amp;rlz=1C1AVSX_enGB447GB448&amp;oq=connect+to+remote+mysql+webserver+php&amp;aqs=chrome.0.69i57j69i62l3.19724j0&amp;sourceid=chrome&amp;ie=UTF-8#fp=5a2359cf96dc5f79&amp;q=how+to+connect+to+remote+mysql+web+server+php</a> </p>
  
  <p>And help would be much appreciated.
  If my question is not clear please let me know I'll try to explain more. or think of it as if you have to connect to a remote MySQL server how would you do , means what is the process and steps involved in that.
  Thanks everyone.</p>
  
  <p>Edit   </p>
  
  <p>I have created a database "dealt3_raj_test" on remote server. and when I type "examplewebserver.CO.UK/myphpscriptname" in my web browser.
  It gives me error "An error occurred , You have reached the error page"</p>
  
  <pre><code>&lt;?PHP   
  $user_name = "dealt3_raj";  
  $password = "5dN5nh&amp;eMd(vCR$dzk";  
  $database = "dealt3_raj_test";  
  $server = "examplewebserver.CO.UK";  
  $db_handle = mysql_connect($server, $user_name, $password);  
  $db_found = mysql_select_db($database, $db_handle);  
  if($db_handle)    
  {         
      print "Connected";  
  }  
  else  
  {  
      print "Can not connect to server";  
  }         
  if ($db_found)   
  { 
       print "DataBase found";  
  }  
  else   
  {  
      print "DataBase not found";  
  }  
  ?&gt;
  </code></pre>