Staff Only | Login
NOTE: This article is part of a series titled: PBBG Development For Beginners.
One great thing about PHP is that it is so popular, that most sites automatically include support for it. This includes sites with PHP and MySQL preinstalled. MySQL is a database management tool, essentially, it holds data that will be needed for record keeping within the game. Obviously we can't keep information such as stats on the user (client) PC or the information could be easily hacked.
PHP can be installed directly on your PC along with MySQL. However, my choice is to work within a live environment, this means a website with PHP support, preferably free and preinstalled. After searching around, I was able to find a free website that includes free PHP, free MySQL, free hosting on their domain and includes cPanel. With 1500 MB of space and 100 GB of monthly bandwidth, it seems that it will serve well as a learning environment and it seems that I could even host a game here if I wished, not bad for the price of $0.
After signing up for my free website I was able to get started with PHP right away without any extra leg work.
My first project was the classic "hello world" project. Getting the phrase "hello world" to display was very easy. Essentially, to make text appear using PHP, you just use the echo command, so for example:
<?PHP echo "Hello World!" ?> will display the phrase Hello World! within the browser window. Very easy. I can see that combining HTML with PHP is easy too and that the <?PHP seen at the beginning of the line and the ?> found at the end of the line defines the line as PHP. Anytime PHP script is used within a web page, even it that page also includes HTML, the name of the page must end with the .php extension.
Of course this isn't very impressive, but it is a first step. Within the next hour I poked around and found a few other interesting projects to get the ball rolling, they include:
- How to display text on a page.
- How to display variable content on a page.
- How to password protect a page. (Fun and Easy)
- And how to display the number of visitors currently on your website.
That last one was a bit tough. The instructions were not 100% clear regarding how to set up and create a table using MySQL and I was not able to do it using the automated method described. But I was able to login to the cPanel, select MySQL to define a database, then return to the cPanel to select MyPHPAdmin and create the table needed to make this script work. After wrestling with it a bit I finally got it to work and walked away with a greater understanding for how things work. I'm not able enough yet to articulate it and if you're new like me, you may not be ready to listen anyway.
If you feel that you are already challenged with just 4 scripts, then I should point out that I don't understand every line of code that makes them all work and my main interest at this point is to just get a feel for for the code. I did find myself referring to relationships between MySQL and standard database programs like access but I'm still not 100% certain.
Article written by:
Whane The Whip



