tags:

views:

51

answers:

3
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');


$host="host.org"; // Host name 
$username="myServer_guest"; // Mysql username 
$password="password"; // Mysql password 
$db_name="myServer_JMblog"; // Database name 
$tbl_name="blog"; // Table name

// Connect to server and select databse.
$link=mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
echo $link.'<br>';


mysql_select_db("$db_name")or die("cannot select DB");
?>

I am getting a successful connection, but now I cannot select the db. All login credentials are correct. Any help would be amazing.

A: 

Good sugegstions in comments already. Another thing to understand is that credentials can be different from differnt boxes. A easy test is to try simple login using mysql-shell directly, preferably if possible from same machin/IP as the php is running on.

Try cmd> mysql -hhost.org -umyServer_guest -ppassword Server_JMblog

You will probably get an error since your php isn't working, post this error and it can tell you more on teh actual problem.

Bjorn
A: 

Stupid question, does the datbase "myServer_JMblog" exist?

Leon
A: 

issue was adding not only remote access for site "abc.com" but also adding the remote site IP. Once this was completed it worked! Thank you Marc B for the great pointers.

jason m