PHP Classes

File: admin/manageNews.php

Recommend this page to a friend!
  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: 15 years ago
Size: 1,032 bytes


Class file image Download
 * manageNews.php
 * Displays all news items with an option to delete or edit each article

$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>";
"<div>Author: $author</div>";
"<div>Content: $content</div>";
"<div><a href=\"editNewsForm.php?id=$id\">Edit</a> | <a href=\"deleteNews.php?id=$id\">Delete</a></div>";
"<br /><hr />";