> I have a script that needs to be able to choose between 3 different
> databases related to a pull down menu.  Any ideas about what functions I
> should be looking at

There's really no need for a function.  Most ANSI standard SQL servers will
allow you to specify databases on the fly in your queries.

So say you had a pulldown menu

<SELECT name="database">
<OPTION value="db1">Database 1</OPTION>
<OPTION value="db2">Database 2</OPTION>
<OPTION value="db3">Database 3</OPTION>
</SELECT>

With this the name of the database will be transfered to the $database
variable upon the form being submitted.
Then:

mysql_query("SELECT * FROM $database.table_name");

Will run a query on the appropriate database...of course this format is
assuming that all the table names will be identical, although if you do have
different table names for each database it's very easy to change that
dynamically as well.

Sincerely,

Craig Vincent


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to