Using MySQL with PHP : mysql_select_db « MySQL Database « PHP






Using MySQL with PHP

 
<?
    $connection = mysql_connect("localhost", "phpuser", "password");
    if ($connection) {
            $db = mysql_select_db("phpdb");
            if (!$db) print "Failed to select 'phpdb'.\n";
    } else {
            print "Failed to connect to database.\n";
    }
?>
  
  








Related examples in the same category

1.Create guestbook table
2.Opening a Connection and Selecting a Database
3.mysql_select_db(): select database
4.mysql_select_db.php
5.mysql_select_db.php