Posted by Anonymous Sat 24th Mar 2007 04:45 - Syntax is None/text - 29 views
Download | New Post | Modify | Hide line numbers
Description:
trying to delete items but it wont work for some reason. i know that it calls
the right things and gets to the if statement but not sure what happens next.
the add feature works fine.

  1.  
  2. if(isset($_POST['add']))
  3. {
  4.   $title = $_POST['title'];
  5.   $content_news = $_POST['content_news'];
  6.   $forward_link = $_POST['forward_link'];
  7.  
  8.   $res = mysql_query("INSERT INTO news (title, content_news, forward_link)
  9.     VALUES ('" . $title . "',  '". $content_news ."',  '". $forward_link ."')");
  10.  
  11.   if ( !$res )
  12.   {
  13.     echo("SQL Error: ". mysql_error());
  14.   }
  15. }
  16.  
  17. if(isset($_POST['delete']))
  18. {
  19. mysql_query("delete from news where email='".$id."'");
  20.  
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27. $query="SELECT * FROM news";
  28. $result=mysql_query($query);
  29. $num=mysql_numrows($result);
  30.  
  31.  
  32. mysql_close($dbh);
  33.  
  34. ?>
  35.            
  36.  
  37. Computer Museum
  38.  
  39. Add News

  40.  
  41. Title
    Passage:
    Link       
  42.    

  43.  
  44.  
  45.  
  46. $i=0;
  47. while ($i < $num) {
  48. $id=mysql_result($result,$i,"id");
  49. $title=mysql_result($result,$i,"title");
  50. $content_news=mysql_result($result,$i,"content_news");
  51. $forward_link=mysql_result($result,$i,"forward_link");
  52. ?>
  53.  
  54.  
  55.  
  56. $i++;
  57. }
  58.  
  59. echo "
  60. Title Content Link
  61. ";
  62. ?>
  63.  

PermaLink to this entry https://pastebin.co.uk/12166
Posted by Anonymous Sat 24th Mar 2007 04:45 - Syntax is None/text - 29 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0