Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Connection {
- public $db;
- public function connection_db(){
- $username = "xxxx";
- $pass = "xxxx";
- $db_name = "xxxx";
- $host = "xxxx";
- $this->bd = new PDO("mysql:host=$host;dbname=$db_name", "$username", "$pass");
- }
- public function __construct() {
- return $this->connection_db();
- }
- public function insert_db(){
- $stmt = $db->prepare("INSERT INTO quotes (author, quote) VALUES (:myauthor, :myquote)");
- $stmt->bindParam(1, $author);
- $stmt->bindParam(2, $quote);
- $stmt->execute();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement