<? $connection = mysql_connect("localhost", "phpuser", "password"); if ($connection) { $db = mysql_select_db("phpdb"); if (!$db) print "Failed to select 'phpdb'.\n"; } else { print "Failed to connect to database.\n"; } ?>