function GetByCode($code) { $sql = "SELECT * FROM kegStatuses WHERE code = '{$code}'"; $qry = mysql_query($sql); if ($i = mysql_fetch_array($qry)) { $kegStatus = new KegStatus(); $kegStatus->setFromArray($i); return $kegStatus; } return null; }
<th width="29%"><center>Model</center></th> </tr> </thead> <tbody> <?php if (count($kegs) == 0) { ?> <tr><td class="no-results" colspan="99">No kegs :(<br>Perhaps you should add one?</td></tr> <?php } else { foreach ($kegs as $keg) { if ($keg->get_kegStatusCode() != null) { $kegStatus = $kegStatusManager->GetByCode($keg->get_kegStatusCode()); } else { $kegStatus = new KegStatus(); } if ($keg->get_kegTypeId() != null) { $kegType = $kegTypeManager->GetById($keg->get_kegTypeId()); } else { $kegType = new KegType(); } ?> <tr> <td rowspan="2" class="intborder"> <center><span class="kegsquare"><?php echo $keg->get_label(); ?> </span></center> </td>