It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

news updating

Moderator: Malcolm

news updating

Postby instinct46 on Tue May 01, 2007 8:59 am

Yea im havin a problem cant figure out how to make the new news to appear at the top cheers in advance heres my code up2 now


<HTML>
<BODY>


<?php
$title = $_POST['title'];
$news = $_POST['news'];
$password = $_POST['password'];

if ( $password == 'post1000000MAIL' ) {

$myFile = "news.txt";
$fh = fopen($myFile, 'a') or die("File Already Exists!");
$otitle = "<H3>";
$ctitle = "</H3><P>\n";
$finish = "<P>\n\n";
$fontoc = "<FONT color=#1b72cb>";
$fontcc = "</FONT>";
$divoc = "<DIV align=center>";
$divcc = "</DIV>";
$linesp = "<HR><P>";
$ldiv = "<DIV align=left>";
$ldivc = "</DIV>";
fwrite($fh, $fontoc);
fwrite($fh, $divoc);
fwrite($fh, $otitle);
fwrite($fh, $title);
fwrite($fh, $ctitle);
fwrite($fh, $divcc);
fwrite($fh, $ldiv);
fwrite($fh, $news);
fwrite($fh, $ldivc);
fwrite($fh, $fontcc);
fwrite($fh, $finish);
fwrite($fh, $linesp);
fclose($fh);

}else{
echo "YOU ARE NOT ALOUD TO SEND MESSAGES *Waggs Finger*<P>";
}

echo "<A HREF=index.php>Back to News Page.</A>";
?>

</BODY>
</HTML>
User avatar
instinct46
50+ Club
 
Posts: 90
Joined: Tue Mar 27, 2007 1:07 pm
Location: St Helens, England

Postby generalchaos316 on Tue May 01, 2007 6:46 pm

I think this might do what you want it to. You will need to modify it slightly to get your HTML tags wrapped around the content properly.
http://fundisom.com/phparadise/php/file_handling/write_to_first_line_of_file
generalchaos316
100+ Club
 
Posts: 101
Joined: Fri Mar 16, 2007 6:01 am

Postby rse on Wed May 02, 2007 3:28 pm

See I would have said "you cant do that, go down the MySQL route instead" but today I have learned something new.

Well done generalchaos316 - good call!
Adam Williams
PHP Web Developer

Personal: http://30things.net
Blog: http://www.root-servers.co.uk
User avatar
rse
100+ Club
 
Posts: 141
Joined: Sun Oct 10, 2004 8:15 pm
Location: Leeds, UK

Postby generalchaos316 on Thu May 03, 2007 6:49 am

Heh, thanks. The previous version of that reply was about 150 lines long and I was even attempting to alter his code so he could cut and paste the solution. All of a sudden I realized that I am still a PHP n00blet and almost forgot how uber Google is. 5 seconds later I found that page, deleted my past 15 minutes of typing, and added it as a bookmark for the future :lol:
generalchaos316
100+ Club
 
Posts: 101
Joined: Fri Mar 16, 2007 6:01 am


Who is online

Users browsing this forum: No registered users and 1 guest