Name
mysql_select_db
Synopsis
boolean mysql_select_db(stringdatabase
[, cresourceconnection
])
Use the
specified database
on a connection.
Subsequent calls to query functions (such as mysql_query(
)
or mysql_unbuffered_query( )
) will
execute on this database
. An optional
connection
resource handle may be
provided; otherwise, the most recently opened connection that is
still open is assumed. If no connection is open, an attempt is made
to open one with a mysql_connect( )
call that has
no parameters.
This function returns true
on success and
false
on failure.
Example
<?php $connection = mysql_connect("localhost", "fred", "shhh"); mysql_select_db("wedding", $connection); ?>
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.