Code:
<?php
$username = "database_username";
$password = "database_password";
$database = "database_name";
$hostname = "localhost";
$connect = mysql_connect("$hostname", "$username", "$password")
or die("Unable to connect to database!");
mysql_select_db("$database", $conn);
?> The first variables you see define your MySQL info. The connect variable makes it either connect you the database or let you know it was unable to.
You can either put this directly int he file you intend to interact with your database or make a new file named sql.php and put all that code in there and include sql.php on the pages you want to use MySQL stuff.
discuss this topic to forum
