Skip to content

Instantly share code, notes, and snippets.

@gakyoo
Created February 8, 2012 21:16
Show Gist options
  • Save gakyoo/1773952 to your computer and use it in GitHub Desktop.
Save gakyoo/1773952 to your computer and use it in GitHub Desktop.
This is a guest class for guestbook, still on development
<?php
/**
* This class extend database class
* It contains all method for managing
* The guest activities.
*
* @author Akyoo
*/
require_once 'database.php';
class guest extends database{
public $title;
public $first_name;
public $middle_name;
public $last_name;
public $date;
public $email;
public $address;
public function __construct($title, $first_name, $middle_name = "", $last_name, $email, $address = ""){
$this -> title = $title;
$this -> first_name = $first_name;
$this -> middle_name = $middle_name;
$this -> last_name = $last_name;
$this -> email = $email;
$this -> address = $address;
}
public function set_title($title){
if(strlen($title) > 1){
$this -> title = $title;
} else {
throw new Exception("Title too short");
}
}
public function set_first_name($first_name){
$this -> first_name = $first_name;
}
public function set_middle_name($middle_name) {
$this -> middle_name = $middle_name;
}
public function set_last_name($last_name){
$this -> last_name = $last_name;
}
public function set_email($email){
$this -> email = $email;
}
public function set_address($address){
$this -> address = $address;
}
public function get_title(){
return $this -> title;
}
public function get_first_name(){
return $this -> first_name;
}
public function get_middle_name(){
return $this -> middle_name;
}
public function get_last_name(){
return $this -> last_name;
}
public function get_email(){
return $this -> email;
}
public function get_address(){
return $this -> address;
}
public function create(){
//create guest instructions
}
public function delete($guest_id){
// delete guest here.
}
public function update($guest_id){
// update guest instructions here.
}
public function find_guest_by_id($guest_id){
// instruction to find a guest by id.
}
public function find_all_guests(){
// instructions to get all guests here.
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment