subject: Web Building Tips - Procedure To Be A Developer [print this page] Web Building Tips - Procedure To Be A Developer
Mysql select database is one of the most important feature of mysql database. Once it connected with Mysql database, it is required to select an exact database with which you get to work. Web Building Tips are the essential tips for increasing knowledge.You can find a lot of databases available with mysql server.
You can use select mysql database by command prompting and php scripting.
Selecting mysql database from command prompt:
This is very easy to select database mysql using mysql command prompt. You can use command use to select a particular database.
Here is an example given below to select database called STUDENTS
[root@host]# mysql -u root -p
Enter password:******
mysql> use STUDENTS;
Database changed
mysql>
Now you have selected STUDENTS database. Therefore all subsequent operations will be performed on STUDENTS database.
But you need to remember that all the database name, table names, table fields name are case sensitive. So, you have to use exact name while using any command prompt.
Selecting mysql database using PHP Script:
mysql selected database is one of the most vital aspect in PHP. PHP provides function mysql_select_db() to use select a particular database. This function returns TRUE when succeed and returns FALSE when failed.
The syntax of mysql_select_db() is shown below:
bool mysql_select_db( db_name, connection);
Where db_name, mysql database name to be selected is required. There is some example of Web Building Tips. But connection is optional. If this connection is not specified, then last opened connection will be used.
Here is an example given below:
Selecting MySQL Database
This is the process of using mysql database selected in PHP.
Now another example shows how to retrieve information from mysql:
Here we will select everything from table "example" and put it into a nicely formatted HTML table.