Search This Blog

Tuesday, 20 January 2015

Create a database using PHP and MySQL.

<?php


$conn= mysql_connect("localhost", "username", "password");




$sql = 'CREATE Database test_db';


$retval = mysql_query( $sql, $conn );


if(! $retval )

{

die('Could not create database: ' . mysql_error());

}

echo "Database test_db created successfully\n";

mysql_close($conn);

?>

No comments:

Post a Comment