本文整理汇总了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;
}
示例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;
}