View Single Post
  #9 (permalink)  
Old 05-03-2007, 02:29 AM
melkior_inactive
Guest
 
Posts: n/a
Default Lesson 3 - First PHP code

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.
Reply With Quote