Looking for a simple way to see if PHP is talking to your Database server? Use this! It’s free!

<?php
$server   = "127.0.0.1"; 
$database = "database-name";
$username = "database-username";
$password = "database-password";

$mysqlConnection = mysql_connect($server, $username, $password);
if (!$mysqlConnection)
{
  echo mysql_error();
}
else
{
mysql_select_db($database, $mysqlConnection);
}
?>

Brian Singer

Principal
With over 20 years of website development experience, Brian brings a wealth of knowledge around data processing, website hosting, high-level marketing strategy, SEO, and more. Brian is a graduate from the McDonogh School, holds a B.F.A. in Imaging Arts and Sciences from Rochester Institute of Technology and serves on the board of several non-profits.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Brian Singer

Principal
With over 20 years of website development experience, Brian brings a wealth of knowledge around data processing, website hosting, high-level marketing strategy, SEO, and more. Brian is a graduate from the McDonogh School, holds a B.F.A. in Imaging Arts and Sciences from Rochester Institute of Technology and serves on the board of several non-profits.

Post Details

Categories:

Related Articles