Now that we have a database ready we need something to input the data and something to display the data from the database.
First, what we'll do is create a config.php file. It will include settings for the database connection and some other configuration info.
Here's the code:
PHP Code:
<?php
$dbuser = 'username'; //database username
$dbname = 'blog'; // database name
$dbpass = 'password'; //database password
$dbhost = 'localhost'; //database host -- usually 'localhost' but best to check with your host
$sitename = 'My Blog'; //name of your site
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>
We'll include this file in our other files in the next step.