mysql_select_db — Select a MySQL database
How to use mysql_select_db consider the below example
Why use mysql_select_db:
How to use mysql_select_db consider the below example
Example #1 mysql_select_db() example
<?php
$db_selected = mysql_select_db('users');// if my database is name'users' then I write 'users' in the above function
}?>Why use mysql_select_db:
we use this to select a database as there will be many databases in the phpmyadmin. so we are specifying that 'users' database should be selected as the function name describes itself
Description
bool mysql_select_db ( string
$database_name [, resource $link_identifier = NULL ] )
Sets the current active database on the server that's associated with the specified link identifier. Every subsequent call to mysql_query() will be made on the active database.
Parameters
database_name- The name of the database that is to be selected.
link_identifier- The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an
E_WARNINGlevel error is generated.
Return Values
Returns
TRUE on success or FALSE on failure.
No comments:
Post a Comment