Skip to content

Instantly share code, notes, and snippets.

@nickknissen
Created December 9, 2013 22:08
Show Gist options
  • Save nickknissen/7881888 to your computer and use it in GitHub Desktop.
Save nickknissen/7881888 to your computer and use it in GitHub Desktop.
<?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;
}
}
?>
<?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