Location: PHPKode > projects > News manager > index.php
<?php
  //load configuration
  require("config.php");
  
  //connect to database
  @mysql_connect($db_server,$db_user,$db_password) or die("Database server connection failed. Check variables \$db_server, \$db_user and \$db_password in config.php");
  @mysql_select_db($db_name) or die("Selecting database failed. Check variable \$db_name in config.php");
  
  //print header
  echo $header;
?>
<h1><?php echo $title; ?></h1>
<hr>
<?php
  //print news
  $result = @mysql_query("SELECT * FROM $db_table ORDER BY date DESC LIMIT 0,$shownews;");

  while($row=@mysql_fetch_array($result)){
    ?><p><strong><?php echo date("m/d/Y - H:i",$row["date"]); ?></strong></p>
    <p><?php echo $row["news"]; ?></p><?php
    
    if($row["links"] != ""){
      ?><p>Links:</p>
      <ul><?php

      $links = explode(",",$row["links"]);

      foreach($links as $link){
        ?><li><a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?></a></li><?php
      }
      
      ?></ul><?php
    }

    ?><hr><?php
  }
  
  //print link to administration
  ?><p align="right"><a href="admin.php">Administration</a></p><?php
  
  //print footer
  echo $footer;

  //close database connection
  @mysql_close();
?>
Return current item: News manager