Created
January 12, 2016 10:44
-
-
Save VictorFursa/83f55f334b81d7e26ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type: text/html; charset=utf-8"); | |
include_once("Db.php"); | |
class GuestBook{ | |
private $firstName; | |
private $email; | |
private $message; | |
function __construct($db,$firstName,$email,$message){ | |
$this->db = $db; | |
$this->firstName = $firstName; | |
$this->email = $email; | |
$this->message = $message; | |
} | |
function getText(){ | |
return " <b><em>Имя автора</b></em>: " . $this->firstName . | |
" <br><b><em>Почта: </b></em> " . " $this->email " . | |
" <br><b><em>Сообщение:</b></em> ". $this->message; | |
} | |
function save(){ | |
return $this->db->query(" INSERT INTO guest_book (firstName,email,message) | |
VALUES(' {$this->firstName} ' , ' {$this->email} ' , ' {$this->message} ' )"); | |
} | |
} | |
$object = new GuestBook($db,'Ололошка','[email protected]','HELL'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment