If you haven't already, get WINAMP up and running. You don't need to put it online just yet. We'll be doing that later. Now first and foremost, I'll not be getting too heavy into php and mysql programming. A good site to go for this if you get a little lost is W3 Schools. Just absolutely phenomenal for learning most web based languages. So yes, a little knowledge of programing PHP will be a must. But I will do my best to explain in detail what each line of code is doing.
Also keep in mind, you can name your files what ever your heart desires, however for the sake of this tutorial, you may just want to keep what I have listed, and if you are feeling adventourous, just make another directory with what you are working on and keep them separate, that way you can go back .
First thing you want to do, it run navicat and access your MySql server (if you get stuck here lemme know - I dont wanna make a tutorial on how to use Navicat). Make a new database called
Start up Crimson Editor(CE for future reference). First file we're gonna make is
SERVERCONFIG.PHP
Also, if you're stuck, visit W3 Schools Just an incredible site for learning any language for the web.
Also keep in mind, you can name your files what ever your heart desires, however for the sake of this tutorial, you may just want to keep what I have listed, and if you are feeling adventourous, just make another directory with what you are working on and keep them separate, that way you can go back .
First thing you want to do, it run navicat and access your MySql server (if you get stuck here lemme know - I dont wanna make a tutorial on how to use Navicat). Make a new database called
wyvern
Thats it for now. Just minimize it, or close it.
Start up Crimson Editor(CE for future reference). First file we're gonna make is
SERVERCONFIG.PHP
OoooK! Some of you first timers might get a little confused on this. Thats ok. Thats what this blog is for. To all you pro's - this doenst need to be fancy, I am aware there are a lot of other ways to do this. But I want it simple. Remeber this blog is for a simple online game thats borderline skeleton in its design.
- $servername = "localhost";
- $serverID = "root";
- $serverPW = "root";
- $connect = mysql_connect($servername,$serverID,$serverPW);
- if (!$connect){
- die ('Could not connect: '.mysql_error());
- }
- mysql_select_db("wyvern",$connect);
- ?>
- Line # 1 and 11: All php pages have to start with this (there are some exceptions).
- Line # 2 Since you are testing this on your own pc (for awhile anyways) set this to LOCALHOST. You can also use 127.0.0.1 which is the same thing. If you are going to use your computer as a server, you can just leave this as is. If for example you are going to use YAHOO! you change that line to MYSQL (original huh?).
- When you installed MySQL Server (v5 right?), it defaulted a user to ROOT. That is fine again if you use YAHOO! it will be what your ID is there. Get the idea. So for now, just leave it to ROOT.
- Same as above, but its the password (which if you've been following along) which is ROOT as well. so you have ID:ROOT and PW:ROOT.
- Just for neatness
- This line is how you connect to your database. In the following order must be servername (localhost), ID (root), and PW(root). the command mysql_connect() is what does the connecting to the database SERVER (we haven't connected to a database yet)
- Using the variable "$connect" (php variables all start with a "$") make sure that it does. If your id, pw server or any of the above are out of whack,
- this line will let you know by using the die command which basically shuts down all operations of your litlle program.
- Once we're connected, select a database we want to work with. In this case its called "wyvern" using the command mysql_connect_db(database name,[optional variable])
Also, if you're stuck, visit W3 Schools Just an incredible site for learning any language for the web.
0 comments:
Post a Comment