code to create table
then to add announcement, you can make form and post it to
and to show announcements
Code:
CREATE TABLE announcement ( `id` int(4) auto_increament, `text` varchar(500) NOT NULL, `date` date, PRIMARY KEY(id) );
Code:
<?php
$text=$_POST['text'];
$date=date("Y-m-d");
mysql_query("INSERT INTO announcement SET tex='".$text."' ,date='".$date."' ");
?>
Code:
<?php
$ann=mysql_query("SELECT text,date FROM announcement ORDER BY date desc,id desc");
while($k=mysql_fetch_array($ann))
{
$text=$k[0];
$date=$k[1];
echo "<div style=\"border:2px solid #ff0000;\">";
echo "$date<br />$text";
echo "</div>";
}
?>



Comment