Connecting to a MySQL database

<?php $database = "YOUR DATABASE"; mysql_connect("localhost", "YOUR USERNAME", "YOUR PASSWORD"); mysql_select_db($database); ?>

You can save this in a file called "connect.php" or whatever, and include it whenever you need to use MySQL.

Sample:

include "connect.php"; $query = mysql_query("select * from banana where fudge='alot' order by taste desc limit 7"); while ($array = mysql_fetch_array($query)){ echo $array['name'] . "
"; }
Digg This

Need a reliable webhost? Take my word for it and go with Hostgator Green Web Hosting by HostGator