Jump to content

Help with an update system


Recommended Posts

I'm making an update system where the site admin writes a new update to a file in the archives which contain only the HTML of the update, not the whole page. Then what I want to happen is for the main index.php file to display the latest 5 updates from the archive directory. I'm not sure how to make that happen. Any and all help in this area would be very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/55515-help-with-an-update-system/
Share on other sites

Just create a table called "updates" with these fields:

 

updateID

poster (person who posted update)

date_posted (date of post, if you wante that)

body (The update itself)

 

Then just make a form, and when they press submit, add the information to the database. Then wherever you want them displayed, all you have to do is pull that information from the database.

 

  • 2 weeks later...

So you have separate HTML pages for each update? What exactly are the updates? I would use a database for most anything. You can use a text file if you don't have SQL access, but some more information on what exactly you're going for would help. If you still want to have separate pages, I think you'd want to have a database with the filenames of each update. The exception would be a directory listing could be changed into an array, but I doubt it can.

I'm actually trying to get it done with a directory array listing. I'm using a code like this:

 

<?php

$dir = '/archives';

$files = opendir($dir);

while (false !== ($filename = readdir($dir))) {

$files[] = $filename;

}

rsort($files)

for ($i = 0; $i < 4; $i++){

include $files[$i];

}

?>

 

However, when I try to view that, I get this message:

 

Parse error: syntax error, unexpected T_FOR in /home/tartagli/domains/mhq.frih.net/public_html/admin/index.php on line 54

 

Line 54 is: for ($i = 0; $i < 4; $i++){

 

I don't know php well, so I can't tell what the syntax error is. Can anyone help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.