Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.     $title = $_GET["article_title"];
  3.     $cat = $_GET["article_cat"];
  4.     $content = $_GET["article_content"];
  5.    
  6.     // Set database server access variables:
  7.     $host = "localhost";
  8.     $user = "root";
  9.     $pass = "root";
  10.     $db = "logansarchive";
  11.  
  12.     // Open connection
  13.     $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
  14.    
  15.     // Select database
  16.     mysql_select_db($db) or die ("Unable to select database!");
  17.    
  18.     $query = "UPDATE Articles ".
  19.         "SET ArticleTitle = '".$title."', Category = '".$cat."', ArticleDate = '".date('Y-m-d H:i:s')."', ArticleContent = '".$content."' ".
  20.         "WHERE ArticleTitle = '".$title."'";
  21.        
  22.     $result = mysql_query($query) or die ("Could not update the article:<br />".$mysql_error());
  23.     header("Location: index.php?result=success");
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement