> Elie De Brauwer <[EMAIL PROTECTED]> said:
> use DBI;
> $dbh = BDI->connect('DBI:mysql:databasename:database:host','username','pass')
> or die $DBI::errst;
>
> Now my problem is the following, in order to connect you have to know the
> databasename but I want it to be that the users get a list of possible
> databases, picks one of them and then uses that database. So simply putting
> a sql show database; to the screen and letting the user pick one out.
> BUT before connecting you already have to know the databasename ... how do i
> solve this ? Or can i stupidly give no databasename ?
You can leave the database name empty. Then you can do the following to get
the database list:
$db_ref = $dbh->selectcol_arrayref("SHOW DATABASES;");
Another connect call with the database name filled in selects the correct
database.
I wrote a generic CGI package to do this for MySQL and it works quite well.
--
Smoot Carl-Mitchell
Consultant
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]