Mega Code Archive

 
Categories / Php / Code Snippets
 

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>"; } ?>