I am officially starting the PHP Blog and News application tutorial. This tutorial is really for beginners to intermediate PHP developers. If you're an expert you will get bored as you probably know alot more then I do on this matter BUT feel free to chime in if you see a better way of doing something or if you'd just like to share your expertise with us.
I am going to explain what I did and all the problems that I went through to make it easier for anyone who wants to learn how to make a blog or a news application in PHP. There was a lot of trial and error during this process so I encourage anyone who gets frustrated or annoyed to keep on trying because the answers are somewhere on the internet. Hopefully, most of those answers will be found here.
Ok, let's start!
Since this is the first tutorial I am just going to go over a few basic things. The first main thing I will be discussing is mySQL and phpMyAdmin! You need mySQL to store all of your database information in. It usually comes with most hosting companies; some windows platforms may or may not have it but check with your hosting company just to be sure. phpMyAdmin is another amazing tool that lets you manage your mySQL databases. This is another tool that should come with your hosting but, once again, check with the hosting company to be sure.
CREATING THE DATABASE
I'll be honest, I've seen developers do this manually with a script using a "CREATE..." line of code but I'm not really 100% familiar on how to do that. So what I did was just create the tables manually through the phpMyAdmin tool.
This is really easy and if you've never done this before than I am going to show you! Oh yes, and if you'd like to have all these fun tools on your desktop and you own a PC than you can visit the wamp server site and download it, FOR FREE!!!!
Ok, back to the database. With my hosting company I have to create a user and database name through the control panel. So look for that option first before going into the phpMyAdmin tool. If you don't have that option, go into the tool and there should be a field that says "Create New Database".
![]()
Type in the name of the database you want to create and click on create. Try to keep the name descriptive to what it is. For instance, since we will be creating a blog/news application, call it “NewsBlog” or something. You can even name the app after your company or dog or whatever, as long as you know what it is.Once you click create you will next have to create tables. A table is like the top category of what will be holding your information. Tables can be labeled as anything you like as long as they are descriptive so you don’t get confused.After you click create you should see something like this:

For the blog and news application, we will be creating 5 tables. The tables to create are as follows:
- blog
- category
- comments
- news
- users
Note: Try to keep everything lowercase as PHP is case sensitive. You don’t know how many times I had issues just because I was using a capital “B” in “blog” rather than a lower case.
Each table will have a certain amount of fields in it. We’ll start with the blog table. I gave the blog 5 fields. For security I’m not going to exactly give the names of the fields I created but basically a description.
So after you create the database name, create the first table and call it “blog”, and give it 5 fields.
After you do that, here’s what you should see:

*Sorry if the image is a bit tiny but I had to keep it within certain parameters.
You get the gist though.
The first field you should create is an id field. This will give each of the blogs an ID number for easy reference. Create the field and set it up with the following parameters.
Type: Integer (int)
Attributes: Unsigned
Extra: Auto Increment
Collation: utf8_unicode_ci
AND select the little radio button for Primary Key ONLY FOR THIS FIELD.
I usually set the collation for all the fields to be the same, I don’t have a specific reason, I just think it will treat each field the same way with the characters that are put in.
After that’s done, create the other fields. Make a field for the date, the text that will be going into the blog (body of the blog, blogbody or something), the title of the blog, and another field for a category id. I’ll explain that later.
Collation is the same for all of them, the type would be as follows, if it’s a number: int, if it’s a short amount of text: varchar, and if it’s a large amount of text: text. ID’s are usually numbers and everything else except the date is either varchar or text. The date is simply date. Just to clarify:
Field Name | Type
Date | date
BlogText | text
Blogtitle | varchar – You can set a limit on the number of characters as well.
Categoryid | int
That should take care of the blog table. Here is the information for the rest of the tables. You can name them whatever you want. The first item listed is the description of what you should name rather than the actual name.
Table: Category
ID of the category | Auto Increment | int | UNSIGNED | primary key
Name of category | varchar
Table: Comments
ID of the comment | Auto Increment | int | UNSIGNED | primary key
ID of the blog that the comments will be associated with (you can make this the same name as what is above for the blog fields) | int
Date | date or datetime depending what you want to show
Name of the comment poster | varchar
The actual comment text | text
Table: News
ID of the news | Auto Increment | int | UNSIGNED | primary key
The Date | date
Title of your news | varchar
A short description of the article | text
The article | text
And lastly…
Table: Users
ID of the users | int
The users login name | varchar
Passwords of user | varchar
Email address of the user | varchar
The users actual name | varchar
That should take care of all the tables and fields!
So now you should have a database set up in mySQL with all of the tables that we will be using and all of the fields for the tables. This is the first step in creating a PHP application if you are using some type of data. Next week, hopefully, I’ll do the next part of the tutorial which will involve the actual coding to access the database information. I hope you enjoyed this, if you have any comments or questions or anything, just fill out the comment form below. Hope to hear from you!











February
25
Thursday
7vIOeU <a href="http://cqdpqxukgrel.com/">cqdpqxukgrel</a>, [url=http://jordcshpkhrv.com/]jordcshpkhrv[/url], [link=http://rnfdpxqdcjmt.com/]rnfdpxqdcjmt[/link], http://gpknbpbtwyjc.com/