Login   Register  
PHP Classes
elePHPant
Icontem

File: admin/manageNews.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrew  >  News Script  >  admin/manageNews.php  >  Download  
File: admin/manageNews.php
Role: Application script
Content type: text/plain
Description: Used to edit/delete articles.
Class: News Script
Manage and publish news stored in a MySQL database
Author: By
Last change:
Date: 2008-07-13 16:00
Size: 1,032 bytes
 

Contents

Class file image Download
<?php
/**
 * manageNews.php
 * 
 * Displays all news items with an option to delete or edit each article
 */
require('../config.php');

$connection mysql_connect($db_host$db_user$db_password
                or die(
"Unable to connect to MySQL");
                            
mysql_select_db($db_name$connection) or die("Unable to select DB!");

/**
 * show all atricles with options to edit/delete
 */
// Use the limit in our settings to decide how many to show
$result mysql_query("SELECT * FROM newstbl ORDER BY date DESC LIMIT 0, $lim");
        
/* While we have more rows display them */
while($row mysql_fetch_assoc($result))
{
    
// Display the row
    
$id $row['id'];
    
$author =  $row['author'];
    
$content $row['content'];
    
    
/**
     * show each article with edit/delete links
     */
    
echo "<div>ID: $id</div>";
    echo 
"<div>Author: $author</div>";
    echo 
"<div>Content: $content</div>";
    echo 
"<div><a href=\"editNewsForm.php?id=$id\">Edit</a> | <a href=\"deleteNews.php?id=$id\">Delete</a></div>";
    echo
"<br /><hr />";
            
}


mysql_close($connection);
?>