PHP/MySql part 3: Create Database
Written by: maffelu , 2009-04-17 07:33:25
<?php
$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
$sql = "CREATE DATABASE MyFirstDB";
//Send the question to the database
$result = mysql_query($sql);
//If everything went as planned...
if($result)
{
echo "Database created!";
}
else
{
echo "Database was not created... =(";
}
?>
There are 2 comments on this article.
Maffelu
2010-10-10 05:09:01
Well, you need more than just database handling to create a game.
Generally, making games in PHP requires you to reload the page for every game event, so flash games (ugh!) or javascript games are more suited for the web.
If you want an example, visit:
http://demo.morkalork.com/game/Flooder/
There I have a demo of a potential game you could make using javascript.
If you have any question or just want to leave a message, just fill out the form below!
Your e-mail will not be visible in your post, it is for validation reasons only
Maffelu
Creator and admin of MorkaLork.com.
Started programming in HTML back when frames and tables was the way to design a page, moved on to Pascal/Delphi, PHP, javascript/jQuery, VB.NET/C#, Java and C++.
Currently studies .NET (in general) focusing on ASP.NET.
markkk
2010-10-09 05:08:23
pls post a code that will create a simple games using php codes.thanks so much