]> git.donarmstrong.com Git - infobot.git/blob - www/htdocs/inc/news.inc
* Remove old unneed CVSROOT
[infobot.git] / www / htdocs / inc / news.inc
1 <?
2 function show_news($limit=5) {
3   global $db_name,$db_handle;
4
5   $query = "SELECT * from news ORDER BY id desc LIMIT $limit";
6   $result = mysql_db_query($db_name,$query,$db_handle);
7
8   while($news = mysql_fetch_array($result))
9   {
10     ?><p><?
11     box_start($news["title"],date("F d, Y",$news["timestamp"])." <br>Posted by ".$news["author"],"90%");
12     echo $news["message"];
13     box_end();
14   }
15 }
16
17 function add_news($author,$title,$message) {
18   global $db_name,$db_handle;
19
20   $timestamp = time();
21   $query = "INSERT INTO news (timestamp,title,author,message) VALUES ('$timestamp','$title','$author','$message')";
22   $result = mysql_db_query($db_name,$query,$db_handle);
23   if (!$result)
24    print("MySQL Error: " . mysql_error());
25 }
26
27 ?>
28