From: Richard Whitehouse Date: Fri, 4 Feb 2011 23:40:10 +0000 (+0000) Subject: Add Ticket::Get X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=ea99045825bbba22f66f5cc4e4991786687eddd8;p=hmb.git Add Ticket::Get --- diff --git a/index.php b/index.php index fc38e79..d8fb165 100644 --- a/index.php +++ b/index.php @@ -212,6 +212,20 @@ class Ticket { return $count; } + public static function Get($id){ + $query = 'SELECT `id`,`type`,`status` FROM `ticket` WHERE `id` = ? LIMIT 1'; + $stmt = Ticketing::Get()->database()->prepare($query); + $stmt->bind_param('i', $type); + $stmt->execute(); + $stmt->bind_result($id, $type, $status); + $ticket = null; + if($stmt->fetch()){ + $ticket = new Ticket($id, $type, $status);; + } + $stmt->close(); + return $ticket; + } + public static function Allocate_Available($type){ if($type instanceof Type){ $type = $type->id();