Showing posts with label Mysql_connect. Show all posts
Showing posts with label Mysql_connect. Show all posts

Friday, 5 June 2015

Mysql: Create a database

<?php
$db = "newdb";
//connect to server with username and password
$connection = @mysql_connect ("localhost","root", "") or die (mysql_error());
//connect to database
$result = @mysql_create_db($db, $connection) or die(mysql_error());
if ($result) {
echo"<P>Database has been created!</P>";
}
?>