View Single Post
Old 04-10-2005   #9 (permalink)
ViciOuS
Registered User
 
ViciOuS's Avatar
 
Join Date: Apr 2005
Posts: 82

Quote:
Originally Posted by Man1c M0g
Instead of deleting the old news, why don't you alter your new scripts so that it only shows the newest 'n' number of entries? That way you can have news archive functionality, a clean frontpage, and avoid the need to constantly delete old news (which will quickly become tedious, trust me...).
Well i'ts not that I want to delete old news, it's just that, I want other admins to be able to delete unwanted news alltogether. Like say an admin makes some news but he forgot a whole paragraph and he needs to delete it and try again.



Here is my DelNews.php It just gives me the error saying news_id isnt a number

Code:
<?php
session_start();

// Define session and password variables
$pw = $_SESSION['password'];
$ad_pw = "******";
$enpw = md5($ad_pw);

// Check to see if they are logged in..
if ($enpw != $pw){
header("Location: Loggedin.php");}

mysql_connect('localhost','ryan_clanad','******');
mysql_select_db('ryan_clanad');

 if(!is_numeric($_GET['news_id'])) die("news_id is not a numeric number1");

 if($_GET['news_id']){
  $sql = "DELETE FROM news WHERE id = '".$_GET['news_id']."' LIMIT 1";

} else {
  $sql = "SELECT id, title FROM news ORDER BY id DESC";
  while($row = mysql_fetch_assoc(mysql_query($sql)))
    echo '<p>
             <a href="'.$_SERVER['PHP_SELF'].'?news_id='.$row['id'].'">Edit: '.$row['title'].'</a>
             </p>';

}
?>
ViciOuS is offline