mysql database connectivity from remote server.

mysql database is on Godaddy.
I want to connect it from remote website.
I tried with following code, but the message is
This page isn’t working
fhiaportal.com is currently unable to handle this request.
HTTP ERROR 500
my connection file is as below.
$user = "xxmyusername";  // actual details are hidden
 $pass = "xxmypassword";
 $db = "xxdatabasename";
 $host = "50.62.209.149";
  $mysqli = mysqli_connect($host,$user, $pass, $db);
$conn = new mysqli($host, $user, $pass, $db);

Open in new window

LVL 1
Rajesh JoshiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ares KurkluSoftware EngineerCommented:
is mysql enabled in php?
Chris StanyonWebDevCommented:
HTTP 500 is a server error, so there's probably something else going on. Generally, your script looks OK, although you only need one connection to the database , not 2 like you currently have. Choose either the OOP way ($conn) or the procedural way ($mysqli). Preerably OOP!

Also, you will need to make sure your GoDaddy DB is setup to allow Direct Database Access - their docs say you need to do this when setting it up as it can't be enabled later.  

Turn on error reporting in your script and you may see more information about what is going wrong. Add this to the very top of your script:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Quoting Chris for emphasis...
Also, you will need to make sure your GoDaddy DB is setup to allow Direct Database Access - their docs say you need to do this when setting it up as it can't be enabled later.  
skullnobrainsCommented:
if you get an error 500, either your script sends it voluntarily ( which is apparently not the case ) of your script was not called at all because of a misconfiguration of the web server. do not bother changing the script before you solve this error. rather have a look at your web server error log
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.