"; global $link; $link = mysql_connect("localhost", "root", ""); print "The connection worked. The link is: $link
"; $result = mysql_select_db( $dbname ); if ( $result ) { print "Database $dbname selected successfully
"; } else { print "Database selection failed.
". mysql_error()."
"; exit(); } } function close_db() { global $link; print "Closing the connection
"; mysql_close( $link ); } ?>