Report this

What is the reason for this report?

PHP MySQL Connectivity

Posted on February 7, 2017

Hi there, this is probably a very basic question but I cannot seem to find the answer on google…

I have installed MySQL and Apache on the cloud server and trying to run a PHP program to indicate whether the connection to a database I have created was successful. I have written the PHP (below) on my personal computer and uploaded the file to the web host I use which is godaddy. For some reason every time I reference this PHP file in the URL the page is blank in the web browser (all my other non database PHP files work ok).

Sorry if this is not clear but could someone please help? I am expecting to see the connection to the database in the cloud was successful!

<?php
$host = 'xxx'; //188.166.....
$user = 'root';
$pass = 'yyy';
$db = 'zzz';

$conn=mysqli_connect($host,$user,$pass,$db);

if($conn)
{
	echo "Connection Successful";
}
else
{
	echo "Could not connect";
}
?>

Thanks,

Alex.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.