本文整理匯總了PHP中showResults函數的典型用法代碼示例。如果您正苦於以下問題:PHP showResults函數的具體用法?PHP showResults怎麽用?PHP showResults使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了showResults函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initializeReport
/**
* @param $course_code
* @return array|bool
*/
function initializeReport($course_code)
{
$course_info = api_get_course_info($course_code);
$table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
$table_students_report = Database::get_main_table('rp_students_report');
$table_semanas_curso = Database::get_main_table('rp_semanas_curso');
$table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_post = Database::get_course_table(TABLE_FORUM_POST, $course_info['dbName']);
$table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION, $course_info['dbName']);
$course_code = Database::escape_string($course_code);
$res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '" . $course_code . "'");
$sqlWeeks = "SELECT semanas FROM $table_semanas_curso WHERE course_code = '$course_code'";
$resWeeks = Database::query($sqlWeeks);
$weeks = Database::fetch_object($resWeeks);
$obj = Database::fetch_object($res);
$weeksCount = (!isset($_POST['weeksNumber'])) ? (($weeks->semanas == 0) ? 7 : $weeks->semanas) : $_POST['weeksNumber'];
$weeksCount = Database::escape_string($weeksCount);
Database::query("REPLACE INTO $table_semanas_curso (course_code , semanas) VALUES ('$course_code','$weeksCount')");
if (intval($obj->cant) != $weeksCount) {
if (intval($obj->cant) > $weeksCount) {
$sql = "DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'";
Database::query("DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'");
} else {
for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id)
VALUES ($i, '$course_code', '0', '0', '0', '0' )")) {
return false;
}
}
}
}
$sql = "REPLACE INTO $table_students_report (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)
SELECT cu.user_id, rs.id, 0, 0, 0, 0
FROM $table_course_rel_user cu
LEFT JOIN $table_reporte_semanas rs ON cu.course_code = rs.course_code
WHERE cu.status = 5 AND rs.course_code = '$course_code'
ORDER BY cu.user_id, rs.id";
if (!Database::query($sql)) {
return false;
} else {
$page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
Database::query("UPDATE $table_students_report sr SET sr.work_ok = 1
WHERE CONCAT (sr.user_id,',',sr.week_report_id)
IN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)
FROM $table_work w JOIN $table_reporte_semanas rs ON w.parent_id = rs.work_id)");
Database::query("UPDATE $table_students_report sr SET sr.thread_ok = 1
WHERE CONCAT (sr.user_id,',',sr.week_report_id)
IN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)
FROM $table_post f JOIN $table_reporte_semanas rs ON f.thread_id = rs.forum_id)");
return showResults($course_info, $weeksCount, $page);
}
}
示例2: searchBooks
function searchBooks()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
$query = composeQuery();
$connection = connect();
$results = mysql_query($query, $connection);
showResults($results);
mysql_close($connection);
}
示例3: showMonthlySalesSummary
function showMonthlySalesSummary()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
$connection = connect();
if (empty($_POST['month'])) {
echo "<p class='center'>Please input a month.</p>";
return;
}
if (empty($_POST['year'])) {
echo "<p class='center'>Please input a year.</p>";
return;
}
$query = composeQuery();
$results = mysql_query($query, $connection);
showResults($results);
mysql_close($connection);
}
示例4: initializeReport
/**
* @param $course_code
* @return array|bool
*/
function initializeReport($course_code)
{
$course_info = api_get_course_info($course_code);
$table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
$table_students_report = Database::get_main_table('rp_students_report');
$table_semanas_curso = Database::get_main_table('rp_semanas_curso');
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_post = Database::get_course_table(TABLE_FORUM_POST);
$table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$course_code = Database::escape_string($course_code);
$res = Database::query("SELECT COUNT(*) as cant FROM {$table_reporte_semanas} WHERE course_code = '" . $course_code . "'");
$sqlWeeks = "SELECT semanas FROM {$table_semanas_curso} WHERE course_code = '{$course_code}'";
$resWeeks = Database::query($sqlWeeks);
$weeks = Database::fetch_object($resWeeks);
$obj = Database::fetch_object($res);
$weeksCount = !isset($_POST['weeksNumber']) ? $weeks->semanas == 0 ? 7 : $weeks->semanas : $_POST['weeksNumber'];
$weeksCount = Database::escape_string($weeksCount);
Database::query("REPLACE INTO {$table_semanas_curso} (course_code , semanas) VALUES ('{$course_code}','{$weeksCount}')");
if (intval($obj->cant) != $weeksCount) {
if (intval($obj->cant) > $weeksCount) {
$sql = "DELETE FROM {$table_reporte_semanas} WHERE week_id > {$weeksCount} AND course_code = '{$course_code}'";
Database::query("DELETE FROM {$table_reporte_semanas} WHERE week_id > {$weeksCount} AND course_code = '{$course_code}'");
} else {
for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
if (!Database::query("INSERT INTO {$table_reporte_semanas} (week_id, course_code, forum_id, work_id, quiz_id, pc_id)\n\t\t\t\t\t\tVALUES ({$i}, '{$course_code}', '0', '0', '0', '0' )")) {
return false;
}
}
}
}
$sql = "REPLACE INTO {$table_students_report} (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)\n\t\t\tSELECT cu.user_id, rs.id, 0, 0, 0, 0\n\t\t\tFROM {$table_course_rel_user} cu\n\t\t\tINNER JOIN {$courseTable} c\n\t\t\tON (c.id = cu.c_id)\n\t\t\tLEFT JOIN {$table_reporte_semanas} rs ON c.code = rs.course_code\n\t\t\tWHERE cu.status = 5 AND rs.course_code = '{$course_code}'\n\t\t\tORDER BY cu.user_id, rs.id";
if (!Database::query($sql)) {
return false;
} else {
$page = !isset($_GET['page']) ? 1 : $_GET['page'];
Database::query("UPDATE {$table_students_report} sr SET sr.work_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)\n\t\tFROM {$table_work} w JOIN {$table_reporte_semanas} rs ON w.parent_id = rs.work_id)");
Database::query("UPDATE {$table_students_report} sr SET sr.thread_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)\n\t\tFROM {$table_post} f JOIN {$table_reporte_semanas} rs ON f.thread_id = rs.forum_id)");
return showResults($course_info, $weeksCount, $page);
}
}
示例5: showContent
function showContent()
{
#----------------------------------------------------------------------
#--- In debug mode, just calculate freshly and don't cache
if (wcaDebug()) {
showResults();
return;
}
#--- If there's no cache or this is an update request, then freshly build the cache
if (!file_exists('generated/statistics.cache') || getBooleanParam('update8392')) {
$startTime = microtime_float();
ob_start();
showResults();
file_put_contents('generated/statistics.cache', ob_get_contents());
ob_end_clean();
$logMessage = sprintf("%s: Updating took %.2f seconds.", wcaDate(), microtime_float() - $startTime);
file_put_contents('generated/statistics.log', "{$logMessage}\n", FILE_APPEND);
echo "<p>{$logMessage}</p>";
}
#--- Show the cache
echo file_get_contents('generated/statistics.cache');
}
示例6: printfive
function printfive($result)
{
$query = "SELECT questionText, answer1Text, answer2Text, postID FROM Question ORDER BY postID DESC;";
$result = mysql_query($query);
$record = mysql_fetch_array($result);
while ($record != false) {
$questionText = $record['questionText'];
$answer1Text = $record['answer1Text'];
$answer2Text = $record['answer2Text'];
$postID = $record['postID'];
$normalQuestion = stripslashes($questionText);
$normalA1 = stripslashes($answer1Text);
$normalA2 = stripslashes($answer2Text);
if (hasVoted($userID, $postID)) {
showResults($postID, $normalQuestion, $normalA1, $normalA2);
} else {
echo "\t<td>{$normalQuestion}</td> ";
echo <<<BLOCK2
\t\t\t\t<tr>
\t\t
\t\t\t\t\t<td>\t\t\t\t\t
\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=1'" class="ans1">
\t\t\t\t\t\t\t\t<input type="image" src="MidiateRedMan.png" name="redman"
\t\t\t\t\t\t\t\twidth="60" height="60" /> {$normalA1}      
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=2'" class="ans2">
\t\t\t\t\t\t\t
\t\t\t\t\t\t\t {$normalA2} <input type="image" src="MidiateBlueMan.png" name="blueman"
\t\t\t\t\t\t\t\twidth="60" height="60" />
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
BLOCK2;
}
$record = mysql_fetch_array($result);
}
}
示例7: htmlspecialchars
?>
">
<input type="hidden" name="userid" value="<?php
echo htmlspecialchars($spotuser['userid']);
?>
">
<?php
if ($dialogembedded) {
?>
<input type="hidden" name="dialogembedded" value="1">
<?php
}
?>
<?php
showResults($result, array('renderhtml' => 1));
?>
<div id="edituserpreferencetabs" class="ui-tabs">
<ul>
<li><a href="#edituserpreftab-1"><span><?php
echo _('General');
?>
</span></a></li>
<?php
if ($tplHelper->allowed(SpotSecurity::spotsec_download_integration, '')) {
?>
<li><a href="#edituserpreftab-2"><span><?php
echo _('NZB handling');
?>
</span></a></li>
示例8: showResults
<?php
include "includes/form-messages.inc.php";
showResults($result);
示例9: showResults
<?php
use Defuse\Crypto\Crypto;
require_once 'autoload.php';
function showResults($type, $start, $end, $count)
{
$time = $end - $start;
$rate = $count / $time;
echo $type, ': ', $rate, ' calls/s', "\n";
}
// Note: By default, the runtime tests are "cached" and not re-executed for
// every call. To disable this, look at the RuntimeTest() function.
$start = \microtime(true);
for ($i = 0; $i < 1000; $i++) {
$key = Crypto::createNewRandomKey();
}
$end = \microtime(true);
showResults("createNewRandomKey()", $start, $end, 1000);
$start = \microtime(true);
for ($i = 0; $i < 100; $i++) {
$ciphertext = Crypto::encrypt(\str_repeat("A", 1024 * 1024), \str_repeat("B", 16));
}
$end = microtime(true);
showResults("encrypt(1MB)", $start, $end, 100);
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
$ciphertext = Crypto::encrypt(\str_repeat("A", 1024), \str_repeat("B", 16));
}
$end = \microtime(true);
showResults("encrypt(1KB)", $start, $end, 1000);
示例10: json_decode
//define vars
$apikey = "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4";
$limit = 10;
$page = $_GET['page'];
if ($page == 0 || !$_GET['page']) {
$page = 1;
}
if ($page == 1) {
$offset = 0;
} else {
$offset = ($page - 1) * $limit - 1;
}
$blog = $term . ".tumblr.com";
//grab current page's posts
$apidata = @file_get_contents("https://api.tumblr.com/v2/blog/{$blog}/posts?api_key={$apikey}&limit={$limit}&offset={$offset}");
if ($apidata !== FALSE) {
$apidata = json_decode($apidata);
$total_post_count = $apidata->response->total_posts;
//grab total count
$mypostsdata = $apidata->response->posts;
$mypostsdata = $apidata->response;
return json_encode($mypostsdata, JSON_PRETTY_PRINT);
} else {
return "Not Found";
}
}
//output
if ($_GET['q']) {
echo showResults(str_replace(' ', '', $_GET['q']));
//remove spaces before searching
}
示例11: showResults
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Phonebook Web Application</title>
<!-- instructor-provided CSS and Image links; do not modify -->
<link href="css/page.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="validator.js"></script>
</head>
<body>
<?php
include "header.html";
include "common.php";
if (isset($_POST["search"])) {
showResults($_POST["criteria"]);
} else {
showResults("");
}
include "footer.html";
?>
</body>
</html>
示例12: htmlspecialchars
<?php
include "includes/form-messages.inc.php";
if (!showResults($result)) {
?>
<form class="edituserform" name="edituserform" action="<?php
echo $tplHelper->makeEditUserAction();
?>
" method="post">
<input type="hidden" name="edituserform[xsrfid]" value="<?php
echo $tplHelper->generateXsrfCookie('edituserform');
?>
">
<input type="hidden" name="userid" value="<?php
echo htmlspecialchars($edituserform['userid']);
?>
">
<fieldset>
<dl>
<dt><label for="edituserform[username]"><?php
echo _('Username');
?>
</label></dt>
<dd><input type="text" disabled="disabled" value="<?php
echo htmlspecialchars($edituserform['username']);
?>
"></dd>
<?php
if ($edituserform['userid'] > SPOTWEB_ANONYMOUS_USERID) {
?>
示例13: showResults
<?php
include "includes/form-messages.inc.php";
/*
* Do we need to redirect on success? If so, perform this
*/
if (isset($data['performredirect']) && $result->isSuccess()) {
$tplHelper->redirect($loginform['http_referer']);
return;
}
# if
$didSubmitForm = showResults($result, $data);
/*
* If the form submission was successful, all output
* we wanted has already been sent (either the JSON
* or the redirect).
*
* If not, we try to re-render the form again
*/
if ($didSubmitForm && !isset($data['renderhtml'])) {
return;
}
# if
/*
* If no HTML headers are sent just yet, make sure
* we send them to the client
*/
if (!isset($data['htmlheaderssent'])) {
include_once "includes/basic-html-header.inc.php";
$data['renderhtml'] = true;
}
示例14: showResults
?>
</p>
<?php
}
?>
<?php
$city = 0;
if (isset($_GET['city'])) {
$city = $_GET['city'];
}
if (isset($_GET['page']) && !preg_match("#[^0-9]#", $_GET['page']) && $_GET['page'] != 0 && $_GET['page'] != '') {
$page = $_GET['page'];
} else {
$page = 1;
}
showResults($_GET['location'], $city, '', 0, '', '', $currentCountry, $page, new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB));
?>
</div>
<div class="right-container">
<?php
showSearchDiv(new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB), $currentCountry);
?>
</div>
</div>
<?php
} else {
示例15: mb_internal_encoding
<title>SELK - Search results for "<?php
print $_POST['search'];
?>
"</title>
<link href="./css/layout.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<?php
mb_internal_encoding("UTF-8");
include "./includes/functions.inc";
$searchstr = $_POST["search"];
$words = returnWords($searchstr);
$sites = findAndSortSites($words);
if (is_array($sites)) {
$results = showResults($sites);
$index = 1;
for ($i = 0; $i < sizeof($results); $i++) {
$index;
$url = $results[$i]['url'];
$title = $results[$i]['title'];
print "<p>{$index}. <a href=\"{$url}\">{$title}</a></p>";
$index++;
}
} else {
print $sites;
}
?>
</body>
</html>