Select mysql database using php
using the below function to select a database Syntax —– bool mysql_select_db($databasename,$connection); $databasename- Name of the Database you want to select $connection– connection string you are getting after executing mysql_connect Example ——-
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $databsehost = 'localhost'; $databasebuser = 'root'; $databasebpassword = ''; $conn = mysql_connect$databsehost,$databasebuser, $databasebpassword); if(! $connection ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db( 'mydoubts' ); mysql_close($connection); ?> |