當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。