// includes include('conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!'); // select database mysql_select_db($db) or die ('Unable to select database!'); // generate and execute query $random_row = mysql_fetch_row(mysql_query("select * from homepage_images order by rand() limit 1")); $random_src = $random_row[1]; ?>