Selecting MySQL Database MYSQL

Selecting MySQL Database  

Selecting MySQL Database

Selecting a MySQL Database Using PHP Script

PHP provides function mysql_select_db to select a database. It returns TRUE on success or FALSE on failure.


Here is an example showing you how to select a database.

      <title>Selecting MySQL Database</title>
         $dbhost = 'localhost:3036';
         $dbuser = 'guest';
         $dbpass = 'guest123';
         $conn = mysql_connect($dbhost, $dbuser, $dbpass);
         if(! $conn ) {
            die('Could not connect: ' . mysql_error());
         echo 'Connected successfully';
         mysql_select_db( 'TUTORIALS' );

Download free E-book of MYSQL

Learn Programming for Free

Join Programmers Community on Telegram

Talk with Experienced Programmers

Just drop a message, we will solve your queries