Jump to content
Larry Ullman's Book Forums

ssrvant

Members
  • Posts

    1
  • Joined

  • Last visited

ssrvant's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I am attempting to try and connect to my mysql database. I am using apache webserver. When I run a php script through localhost through my browser the script works well. When I run my mysql_connect.php then all I get is a blank page. nothing happens. I placed an echo statement at the end to verify that it connected. The echo statement doesn't appear when I refresh the page. Here is my code: <?php # Script 7.2 - mysql_connect.php // This file contains the database access information. // This file also establishes a connection to MySQL and selects the database. // Set the database access information as constants. DEFINE ('DB_USER', 'root'); DEFINE ('DB_PASSWORD', 'xxxxxxxxx'); DEFINE ('DB_HOST', 'localhost:3306'); DEFINE ('DB_NAME', 'reg'); // Make the connnection. $dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() ); // Select the database. @mysqli_select_db(DB_NAME) OR die ('Could not select the database: ' . mysql_error() ); echo 'hello'; ?>
×
×
  • Create New...