Skip to content

Instantly share code, notes, and snippets.

@VictorFursa
Created January 12, 2016 10:44
Show Gist options
  • Save VictorFursa/83f55f334b81d7e26ae4 to your computer and use it in GitHub Desktop.
Save VictorFursa/83f55f334b81d7e26ae4 to your computer and use it in GitHub Desktop.
<?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