Latest News: Latest changes and upcoming changes here at ZoomCities IT Community - Aug 26, 2010
|
News system in PHP/MySQL
|
|||
| Author | Message | ||
|
07-28-2008, 09:40 PM
Post: #1
|
|||
|
|||
|
News system in PHP/MySQL
So you want a news system? This is a tutorial on how to make one. No ready-made script but a great (and handy) explanation.
1. Requirements Basic knowledge of PHP and MySQL, a text editor (e.g. Notepad) and a browser. 2. Database Structure The database will have to look something like : table 'news' - id INT AUTO_INCREMENT, - author VARCHAR(xxx), - title VARCHAR(xxx), - message TEXT, - date INT, - PRIMARY KEY(id) Notice that date is INT. That's because we'll be storing the value of php function time() which gives you a very big nummer that can be converted to dates. 2. Insert Script The form to insert news should be only accesible by you (and/or assistents). That's why it's nice to include a small check, such as a password check. If you have a complete usersystem, you could include a usercheck to see if the user is e.g. an admin/moderator. $password should be your desired password. Code: <?phpNow you have to show the data. Code: <?phpSo now you have seen the basics of how to make a news system. You can add as many features as you like, such as categories, showing the last 10 news items, ... |
|||
|
07-28-2008, 11:34 PM
(This post was last modified: 07-28-2008 11:39 PM by yesar92.)
Post: #2
|
|||
|
|||
|
RE: News system in PHP/MySQL
This is a great tut. but I have no knowledge of database programing .... u deserve reputation marks for that! its great. but i understand nothing from the first step.
How much time does it take to create that script? and can it be integrated into a php page can pictures be added to posts. |
|||
|
07-28-2008, 11:57 PM
(This post was last modified: 07-28-2008 11:58 PM by Destelbergen.)
Post: #3
|
|||
|
|||
RE: News system in PHP/MySQL
yesar92 Wrote:This is a great tut. but I have no knowledge of database programing .... u deserve reputation marks for that! its great. but i understand nothing from the first step. The first step is how your database should look like. You can make databases in PHP, but it's easier in PhpMyAdmin. If you have some knowledge of PHP, the script can be created in less then an hour. If you have a good knowledge of PHP you can do it in 30 minutes. Offcourse it can be integrated, with some general knowledge of PHP you can do that without too much problems. And pictures can be added using html. It's really worth the effort to learn some PHP
|
|||
|
07-28-2008, 11:58 PM
(This post was last modified: 07-29-2008 12:02 AM by darkfate.)
Post: #4
|
|||
|
|||
|
RE: News system in PHP/MySQL
That script would be about five minutes easy for me. Not even. It's not filtering out any HTML, so you can do anything you want there. Also, time() returns a UNIX timestamp which is only 10 numbers long; not that bad.
EDIT: SQL isn't that hard: Code: CREATE TABLE `news` (Dave / Tumblr / Neutron Server Admin CCSU '12 : Management Information Systems |
|||
|
07-29-2008, 12:21 AM
(This post was last modified: 07-29-2008 12:22 AM by yesar92.)
Post: #5
|
|||
|
|||
|
RE: News system in PHP/MySQL
k so i create the database table , I now know how to do that using phpMyAdmin , but what about the script? Do I create a new php document then insert the code in step 3 (Insert Script) into that document and I call it news.php for instance.
Than integrate the show script code into my index.php page. Am I doing well? or Am I missing somethings? |
|||
|
07-29-2008, 12:27 AM
(This post was last modified: 07-29-2008 12:31 AM by Destelbergen.)
Post: #6
|
|||
|
|||
RE: News system in PHP/MySQL
darkfate Wrote:That script would be about five minutes easy for me. Not even. It's not filtering out any HTML, so you can do anything you want there. Also, time() returns a UNIX timestamp which is only 10 numbers long; not that bad.I'd use Code: CREATE TABLE `news` (yesar92 Wrote:k so i create the database table , I now know how to do that using phpMyAdmin , but what about the script? Do I create a new php document then insert the code in step 3 (Insert Script) into that document and I call it news.php for instance.Yes, you miss something. I didn't include a database connection. I never include ready-made scripts (point of a tutorial is to learn how to do something, not to use the copy-paste function once more) |
|||
|
07-29-2008, 12:52 AM
Post: #7
|
|||
|
|||
|
RE: News system in PHP/MySQL
K thanx I will try to complete that script now.
Thanx |
|||
« Next Oldest | Next Newest »
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| PHP/MySQL test server | Destelbergen | 10 | 1,005 |
11-12-2009 01:49 PM Last Post: Freakstorm |
|
| How To Submit Data To MySQL Database | Ben | 1 | 377 |
04-08-2008 07:43 AM Last Post: Ben |
|
| Computer System Basics | marobend | 0 | 348 |
03-29-2007 05:07 PM Last Post: marobend |
|
| [MySQL] Basic Usage | Deth | 2 | 537 |
03-28-2007 05:56 AM Last Post: darkfate |
|
| PHP (early beginner) - 1 Connecting to a MySQL database | ldechent | 5 | 566 |
12-10-2006 05:10 AM Last Post: darkfate |
|
| [php mysql]Connectiing to database | Demonic | 7 | 786 |
10-08-2006 02:23 PM Last Post: iTz RaMpAgE |
|
| [php mysql]SELECTING INFORMATION FROM Database | Demonic | 1 | 484 |
08-06-2006 11:16 PM Last Post: darkfate |
|
| [Database Tutorial] PHP and MySQL | Fadel | 0 | 394 |
07-07-2006 10:11 PM Last Post: Fadel |
|
|

ZC Blog
ZC Directory
Gallery
Search
Member List
Calendar
Help









