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.85 KB | None | 0 0
  1. <?php
  2.     $srctitle = $_POST["srctitle"];
  3.     $title = $_POST["article_title"];
  4.     $cat = $_POST["article_cat"];
  5.     $content = $_POST["article_content"];
  6.    
  7.     // Set database server access variables:
  8.     $host = "localhost";
  9.     $user = "root";
  10.     $pass = "root";
  11.     $db = "logansarchive";
  12.  
  13.     // Open connection
  14.     $dbh = new PDO('mysql:host='.$host.';dbname='.$db, $user, $pass);  
  15.    
  16.     $date = date('Y-m-d H:i:s')
  17.     $query = $dbh->prepare("UPDATE Articles ".
  18.         "SET ArticleTitle = :title, Category = :cat, ArticleDate = :date, ArticleContent = :content ".
  19.         "WHERE ArticleTitle = :srctitle");
  20.     $query->bindParam(':title', $title);
  21.     $query->bindParam(':cat', $cat);
  22.     $query->bindParam(':date', $date);
  23.     $query->bindParam(':content', $content);
  24.     $query->bindParam(':srctitle'. $srctitle);
  25.     $query->execute();
  26.     header("Location: index.php?result=success");
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement