Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.     $title = $_POST["article_title"];
  3.     $cat = $_POST["article_cat"];
  4.     $content = $_POST["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.     $dbh = new PDO('mysql:host='.$host.'dbname='.$db., $user, $pass);
  14.  
  15.     $dbh->beginTransaction();
  16.     $query = "UPDATE Articles ".
  17.         "SET ArticleTitle = '".$title."', Category = '".$cat."', ArticleDate = '".date('Y-m-d H:i:s')."', ArticleContent = '".$content."' ".
  18.         "WHERE ArticleTitle = '".$title."'";
  19.     $dbh->exec($query);
  20.  
  21.     header("Location: index.php?result=success");
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement