Advertisement
Guest User

Untitled

a guest
Dec 25th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. class Connection {
  3. public $db;
  4.  
  5. public function connection_db(){
  6. $username = "xxxx";
  7. $pass = "xxxx";
  8. $db_name = "xxxx";
  9. $host = "xxxx";
  10. $this->bd = new PDO("mysql:host=$host;dbname=$db_name", "$username", "$pass");
  11. }
  12.  
  13. public function __construct() {
  14. return $this->connection_db();
  15. }
  16.  
  17. public function insert_db(){
  18. $stmt = $db->prepare("INSERT INTO quotes (author, quote) VALUES (:myauthor, :myquote)");
  19. $stmt->bindParam(1, $author);
  20. $stmt->bindParam(2, $quote);
  21. $stmt->execute();
  22.  
  23. }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement