in reply to Re: check if databse exists before connection is made!
in thread check if databse exists before connection is made!

is this correct?
$db1 = DBI->connect("DBI:mysql:nikos_db", "root", "") or $db2 = DBI->connect("DBI:mysql:nikos_db:50free.net", "nikos_db", "macg +yver"); if (!$db2 and $db1) { print font( {-size=>5, -color=>'Lime'}, "$DBI::e +rrstr" ); $db=$db1; } if (!$db1 and $db2) { print font( {-size=>5, -color=>'Lime'}, "$DBI::e +rrstr" ); $db=$db2; } $db->do( "drop database if exists nikos_db" ); $db->do( "create database nikos_db" ); $db->do( "use nikos_db" );

Replies are listed 'Best First'.
Re: Re: Re: check if databse exists before connection is made!
by Nik (Initiate) on Feb 06, 2004 at 19:09 UTC
    i want my script to be able to determine if it runs on localhost or if it runs on the remote server. and also if it fails to connct to the mysql server to give the appropriate message for localhost and appropriate message for the remote web server! id the above code correct? thank you!