Location: PHPKode > projects > BlueBoy What's New > bb_news.php3
<?
//////////////////////////////////////////////////////////////////////////////////////////
//                                                                                      //
//  BlueBoy Whats New APP v. 1.0.3                                                      //
//  by Mike Norton                                                                      //
//  hide@address.com   http://www.blueboymultimedia.com                                  //
//                                                                                      //
//  You may use this to your hearts content.  It is Open Source :-)                     //
//                                                                                      //
//////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////
//                                                                                      //
// Create your table by running this SQL statment in MySQL:                             // 
//--------------------------------------------------------------------------------------//
//                                                                                      //
// CREATE TABLE news (                                                                  //
//   id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,                           //
//   subject varchar(50) NOT NULL,                                                      //
//   news blob NOT NULL,                                                                //
//   date datetime DEFAULT '0000-00-00' NOT NULL,                                           //
//   author varchar(50) NOT NULL,                                                       //
//   link varchar(150),                                                                 //
//   PRIMARY KEY (id)                                                                   //
//  );    
//
//  You may also run the bb_news.mysql file to create the database.                                                                              //
//                                                                                      //
//////////////////////////////////////////////////////////////////////////////////////////

///  MAIN APP  /////////////

// Database entry points.  Gets all info from config.inc
//
require ("bb_news_config.inc");
mysql_connect($bb_news_hostname,$bb_news_mysqluser,$bb_news_mysqlpassword)
               or die("Unable to connect to SQL server");  // We do this to handle the errors

// news is the name of the table
//
// We select only 5 of the latest records here, ordered by id number.  You can change that
// to any number you would like or you can take it out all together
//
$query = "select id, subject, news,  date_format(date, '%m/%d/%Y %h:%i %p') as date, author, link from news
    order by id desc limit 5";   

$news =  mysql_db_query($bb_news_db, $query) or die("Select Failed!");

// We do this untill there is nothing left to do in the select statment.
//
while ($row = mysql_fetch_array($news)) {


// Formating is completly up to you.  This is a sample.
//
// Color settings are in config.inc
//
?>

<font face="Arial, Helvetica, sans-serif" size="2">
<font color="<? echo $bb_news_date_fn; ?> "><? echo $row['date']; ?></font> by <font color="<? echo $bb_news_author_fn; ?>"><? echo $row['author']; ?></font><br>
                            <b><font color="<? echo $bb_news_subject_fn; ?>"><? echo $row['subject']; ?></font></b><br>
                            <font color="<? echo $bb_news_text_fn; ?>">
							<? echo $row['news']; ?><br></font>
                            <a href="<? echo $row['link']; ?>"><? echo $row['link']; ?></a></font> 
                          </font></div><font face="Arial, Helvetica, sans-serif" size="2">
                          <hr>

<?
// Now we are done.  Simple call this file from within your php3 app useing
// require ("bb_news.php3"); in your code.  Dont forget to include the open and close php

 } ?>
Return current item: BlueBoy What's New