daily pastebin goal
81%
SHARE
TWEET

Untitled

a guest Jun 17th, 2017 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $hostname = 'somehost';
  3. $username = 'someuser';
  4. $password = 'somepasswd';
  5.  
  6. try {
  7.     $dbh = new PDO("mysql:host=$hostname;dbname=areautenti", $username, $password);
  8.     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9.  
  10.     $user = $_POST['user'];
  11.     $id = $_POST['id'];
  12.     $content = $_POST['content'];
  13.  
  14.     $table = "sitecontent_".$user;
  15.  
  16.     $stmt = $dbh->prepare("UPDATE $table SET content = :content WHERE id= :id");
  17.  
  18.     $stmt->bindParam(':content', $content, PDO::PARAM_*);
  19.     $stmt->bindParam(':id', $id, PDO::PARAM_INT, 5);
  20.  
  21.     $stmt->execute();
  22.  
  23.     $result = $stmt->fetchAll();
  24.  
  25.     $dbh = null;
  26. }
  27. catch(PDOException $e)
  28.     {
  29.     echo $e->getMessage();
  30.     }
  31. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top