Left Quote    Wise men speak because they have something to say; Fools because they have to say something.
- Plato (427-347 B.C.)    
Right Quote
[login] | [Register]

Building a News Management System

by: sm0ke
Page: 1 of 5
(View All)


The 3 things we need initially will be:
  • PHP (Hypertext preprocessor)
  • MySQL (Structured Query Language)
  • Apache (Web Server)
  • PHPMyAdmin is also a useful tool to use.
Got them? Right on with the show.

Create Table

Firstly we need to make sure we have a table created on our database:

The code above wll create a table on your MySQL Database called "news" with the following fields created:
  • id - The unique identifior of the news post
  • title - The title of your news post
  • content - The main body of your news post
  • author - The name of the author
  • date - The date and time of the news post (this will be formatted to a readable string using another file we create later on)


So now that we have a table created we need a way to log into the database. This code will create a database connection. Save the file as "" in a directory called "site"

OK so now we have a database with a table called news, and a small file which contains the database login information along with the functions to log in and out of the database. The file is very important, because it eliminates the need to write your DB access details accross many files.

1  |  2  |  3  |  4  |  5  |  
Next »


  Subject: "User Access" Date: Mar 31 2008 at 11:57 pm    
Is there a way to set multiple access levels? I want to allow moderators to post, but not delete admin posts or other mod posts, just post news. And then allow basic user access for viewing.
  Subject: "typing error" Date: Nov 16 2008 at 10:41 am    
the row gets deleted from the table but then the entire PURPOSE of the script is gone.
You Must be logged in or a member to comment.

Tutorial Stats

Tutorial Stats

6 Total Comments
0 Rating of 5 ( Votes)


Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article



· Simple PHP Tutorial
· One File Website
· Pagination with PHP
· Building a Comments Script
· Complete Members System
· Variable Scope

"" Copyright © 2002-2021; All rights lefted, all lefts righted.
Privacy Policy