Created
December 9, 2013 22:08
-
-
Save nickknissen/7881888 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 | |
namspace Models; | |
class Jokes | |
{ | |
public $question; | |
public $punchline; | |
public function __construct($question, $punchline, $created_by) { | |
$this->question = $question; | |
$this->$punchline= $$punchline; | |
$this->created_by = $created_by; | |
} | |
} | |
?> |
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 | |
namspace serviceLayer; | |
use Models\Joke as JokeModel; | |
use Db | |
class JokeService { | |
public static function create(\MVC\Joke $joke) { | |
$session = Db::prepare('INSERT INTO jokes (question, punchline, created_by) VALUES (?, ?, ?)'); | |
$session->bind_param('sss', $joke->question, $joke->punchline, $joke->created_by); | |
$session->execute(); | |
$session->close(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment