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