当前位置: 首页>>代码示例>>PHP>>正文


PHP Contest::setID方法代码示例

本文整理汇总了PHP中Contest::setID方法的典型用法代码示例。如果您正苦于以下问题:PHP Contest::setID方法的具体用法?PHP Contest::setID怎么用?PHP Contest::setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contest的用法示例。


在下文中一共展示了Contest::setID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadFromDatabase

 /**
  * Crea un post caricando i dati dal database.
  * È come fare una ricerca sul database e poi fare new Post().
  *
  * @param $id: l'ID del post da caricare.
  * @return: il post caricato o FALSE se non lo trova.
  */
 static function loadFromDatabase($id)
 {
     require_once "query.php";
     $db = new DBManager();
     if (!$db->connect_errno()) {
         $table = Query::getDBSchema()->getTable(TABLE_CONTEST);
         $rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(CONTEST_ID), Operator::EQUAL, $id)), array()), $table->getName(), null);
         //echo "<p>" . $s . "</p>"; //DEBUG
         //echo "<p>" . mysql_num_rows($rs) . "</p>"; //DEBUG
         if ($db->num_rows() == 1) {
             // echo serialize(mysql_fetch_assoc($rs)); //DEBUG
             $row = $db->fetch_result();
             $data = array("title" => $row[CONTEST_TITLE], "description" => $row[CONTEST_DESCRIPTION], "rules" => $row[CONTEST_RULES], "prizes" => $row[CONTEST_PRIZES], "start" => date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[CONTEST_START])), "end" => date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[CONTEST_END])), "subscriberType" => $row[CONTEST_TYPE_OF_SUBSCRIBER]);
             $c = new Contest($data);
             $c->setID(intval($row[CONTEST_ID]));
             $c->loadSubscribers()->loadWinners();
             //echo "<p>" .$p ."</p>";
             return $c;
         } else {
             $db->display_error("Contest::loadFromDatabase()");
         }
     } else {
         $db->display_connect_error("Contest::loadFromDatabase()");
     }
     return false;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:33,代码来源:Contest.php

示例2: createFromDBRow

 private function createFromDBRow($row)
 {
     $data = array("title" => $row[DB::CONTEST_TITLE], "description" => $row[DB::CONTEST_DESCRIPTION], "rules" => $row[DB::CONTEST_RULES], "prizes" => $row[DB::CONTEST_PRIZES], "start" => date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[DB::CONTEST_START])), "end" => date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $row[DB::CONTEST_END])), "subscriberType" => $row[DB::CONTEST_TYPE_OF_SUBSCRIBER]);
     $c = new Contest($data);
     $c->setID(intval($row[DB::CONTEST_ID]));
     if ($this->loadSubscribers) {
         $this->loadSubscribers($c);
     }
     if ($this->loadWinners) {
         $this->loadWinners($c);
     }
     return $c;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:13,代码来源:ContestDao.php


注:本文中的Contest::setID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。