MorkaLork Development

Interesting stuff I've picked up over the years...

PHP/MySql part 3: Create Database

2009-04-17 07:33:25 | 261 views | php mysql create database result sql

Creating a database with PHP is not hard.

$host="localhost"; // Host name
$username="MyUsername"; // Mysql username
$password="MyPassword"; // Mysql password

//The connection
mysql_connect("$host", "$username", "$password")or die("cannot connect");

//The Mysql commandline
//Send the question to the database
$result = mysql_query($sql);
//If everything went as planned...
echo "Database created!";
echo "Database was not created... =(";

That's about as easy as it gets...

Article comments

Feel free to comment this article using a facebook profile.

I'm using facebook accounts for identification since even akismet couldn't handle all the spam I receive every day.