Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 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.     $date = date('Y-m-d H:i:s')
  16.     $query = $dbh->prepare("UPDATE Articles ".
  17.         "SET ArticleTitle = :title, Category = :cat, ArticleDate = :date, ArticleContent = :content ".
  18.         "WHERE ArticleTitle = '".$title."'");
  19.     $query->bindParam(':title', $title);
  20.     $query->bindParam(':cat', $cat);
  21.     $query->bindParam(':date', $date);
  22.     $query->bindParam(':content', $content);
  23.     $query->execute();
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement