本文整理匯總了PHP中Contest::fetchRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contest::fetchRaw方法的具體用法?PHP Contest::fetchRaw怎麽用?PHP Contest::fetchRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Contest
的用法示例。
在下文中一共展示了Contest::fetchRaw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Database
<?php
session_start();
include '../config/config.php';
$dbObj = new Database($cfg);
//Instantiate database
$thisPage = new WebPage($dbObj);
//Create new instance of webPage class
$contestObj = new Contest($dbObj);
// Create an object of Contest class
$errorArr = array();
//Array of errors
//get the contest id; if failed redirect to contest-categories page
$thisContestId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo('manage-contests');
//Check if the contest exists if not redirect it to manage-contests page
if (count($contestObj->fetchRaw("*", " id = {$thisContestId} ")) < 1) {
$thisPage->redirectTo('manage-contests');
}
foreach ($contestObj->fetchRaw("*", " id = {$thisContestId} ") as $contest) {
$contestData = array('status' => 'status', 'id' => 'id', 'title' => 'title', 'intro' => 'intro', 'description' => 'description', 'header' => 'header', 'logo' => 'logo', 'startDate' => 'start_date', 'endDate' => 'end_date', 'announcementDate' => 'announcement_date', 'winners' => 'winners', 'question' => 'question', 'answer' => 'answer', 'point' => 'point', 'bonusPoint' => 'bonus_point', 'rules' => 'rules', 'prize' => 'prize', 'message' => 'message', 'css' => 'css', 'dateAdded' => 'date_added', 'announceWinner' => 'announce_winner', 'restart' => 'restart', 'restartInterval' => 'restart_interval', 'cutOffPoint' => 'cut_off_point', 'theme' => 'theme');
foreach ($contestData as $key => $value) {
switch ($key) {
default:
$contestObj->{$key} = $contest[$value];
break;
}
}
}
$cfg->templateName = $contestObj->theme ? $contestObj->theme : 'default';
?>
<!DOCTYPE html>
示例2: contest
<!-- Page Content -->
<div class="container">
<!-- Jumbotron Header -->
<header class="jumbotron hero-spacer panel panel-default">
<h1>A Warm Welcome!</h1>
<p>Below is/are the available sweepstakes or contest(s) </p>
</header>
<hr>
<!-- Page Features -->
<div class="row text-center">
<?php
foreach ($contestObj->fetchRaw("*", " status= 1 ", " id DESC") as $contest) {
$contestData = array('status' => 'status', 'id' => 'id', 'title' => 'title', 'intro' => 'intro', 'description' => 'description', 'header' => 'header', 'logo' => 'logo', 'startDate' => 'start_date', 'endDate' => 'end_date', 'announcementDate' => 'announcement_date', 'winners' => 'winners', 'question' => 'question', 'answer' => 'answer', 'point' => 'point', 'bonusPoint' => 'bonus_point', 'rules' => 'rules', 'prize' => 'prize', 'message' => 'message', 'css' => 'css', 'dateAdded' => 'date_added', 'announceWinner' => 'announce_winner', 'restart' => 'restart', 'restartInterval' => 'restart_interval', 'cutOffPoint' => 'cut_off_point', 'theme' => 'theme');
foreach ($contestData as $key => $value) {
switch ($key) {
case 'header':
$contestObj->{$key} = MEDIA_FILES_PATH1 . 'contest-header/' . $contest[$value];
break;
case 'logo':
$contestObj->{$key} = MEDIA_FILES_PATH1 . 'contest-logo/' . $contest[$value];
break;
default:
$contestObj->{$key} = $contest[$value];
break;
}
}
?>