本文整理汇总了PHP中Db::getResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::getResult方法的具体用法?PHP Db::getResult怎么用?PHP Db::getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::getResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllUserOrder
/**
* @url GET user/{userId}
*/
protected function getAllUserOrder($userId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = 'SELECT * FROM `order` WHERE userId = :userId ORDER BY status DESC';
$bind = array('userId' => $userId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例2: getAllUserSection
/**
* @url GET user/{userId}
*/
protected function getAllUserSection($userId, $courseId)
{
$statement = '
SELECT *
FROM section AS S
WHERE S.courseId = :courseId
';
$bind = array('courseId' => $courseId);
return \Db::getResult($statement, $bind);
}
示例3: getAllCourseItem
/**
* @url GET allcourseitem/{courseId}
*/
protected function getAllCourseItem($courseId)
{
$statement = '
SELECT *
FROM view_course_item AS VCI
WHERE VCI.courseId = :courseId
';
$bind = array('courseId' => $courseId);
return \Db::getResult($statement, $bind);
}
示例4: RouteReport
function RouteReport()
{
$varResult = Db::getResult('SELECT * FROM routes ORDER BY rtcode');
echo '<div id="RouteReport" class="RouteReport">' . "\n";
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
echo '<tr><th><h3>Route</h3></th><th><h3>Assignment</h3></th></tr>';
foreach ($varResult as $varRouteReport) {
echo '<tr><td>' . $varRouteReport['rtcode'] . ' - ' . $varRouteReport['description'] . '</td>';
echo '<td>' . $varRouteReport['assignment'] . '</td></tr>';
}
echo '</table>';
echo '</div>';
}
示例5: getAllCommentDetail
/**
* @url GET allcommentdetail/{commenHeaderId}
*/
protected function getAllCommentDetail($commenHeaderId)
{
$statement = '
SELECT CD.*, U.nickname, U.avatarId
FROM comment_detail AS CD
INNER JOIN user AS U
ON U.userId = C.userId
WHERE commentHeaderId = :commentHeaderId
ORDER BY CD.timestamp
';
$bind = array('commentHeaderId' => $commentHeaderId);
return \Db::getResult($statement, $bind);
}
示例6: getItem
/**
* @url GET item/{courseSectionId}
*/
protected function getItem($courseSectionId)
{
if (\TTO::getRole() == 'admin') {
$statement = '
SELECT *
FROM view_course_item AS CI
WHERE CI.courseSectionId = :courseSectionId
ORDER BY CI.courseItemId DESC
';
$bind = array('courseSectionId' => $courseSectionId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例7: getAllNotification
/**
* @url GET allnotification/{userId}
*/
protected function getAllNotification($userId)
{
$statement = '
SELECT N.*, U.nickname, FU.nickname AS fromNickname
FROM notification AS N
INNER JOIN user AS U
ON U.userId = N.userId
INNER JOIN user AS FU
ON FU.userId = N.fromUserId
WHERE N.userId = :userId
ORDER BY N.timestamp DESC
';
$bind = array('userId' => $userId);
return \Db::getResult($statement, $bind);
}
示例8: getUserCourseList
/**
* @url GET usercourselist/{userId}
*/
protected function getUserCourseList($userId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = '
SELECT *
FROM user_course AS UC
INNER JOIN course AS C
ON UC.courseId = C.courseId
WHERE UC.userId = :userId
';
$bind = array('userId' => $userId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例9: getAllUserItem
/**
* @url GET /user/{userId}
*/
protected function getAllUserItem($userId, $taskId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = '
SELECT I.*, UI.userId, UI.status, UI.point, UI.userContent
FROM item AS I
LEFT OUTER JOIN user_item AS UI
ON UI.itemId = I.itemId
AND UI.userId = :userId
WHERE I.taskId = :taskId
';
$bind = array('userId' => $userId, 'taskId' => $taskId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例10: getByCourseSection
/**
* @url GET by-course-section/{userId}/{courseSectionId}
*/
protected function getByCourseSection($userId, $courseSectionId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = '
SELECT *
FROM view_course_item AS CI
LEFT OUTER JOIN user_course_item AS UCI
ON CI.courseItemId = UCI.courseItemId
AND UCI.userId = :userId
WHERE CI.courseSectionId = :courseSectionId
ORDER BY CI.courseItemId
';
$bind = array('userId' => $userId, 'courseSectionId' => $courseSectionId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例11: getAllUserTask
/**
* @url GET user/{userId}
*/
protected function getAllUserTask($userId, $sectionId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = '
SELECT T.*, TT.name AS taskTypeName, TT.theme
FROM task AS T
INNER JOIN task_type AS TT
ON TT.taskTypeId = T.taskTypeId
LEFT OUTER JOIN user_task AS UT
ON UT.taskId = T.taskId
AND UT.userId = :userId
WHERE sectionId = :sectionId
';
$bind = array('userId' => $userId, 'sectionId' => $sectionId);
return \Db::getResult($statement, $bind);
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例12: getByCourseItem
/**
* @url GET by-course-item/{userId}/{courseItemId}
*/
protected function getByCourseItem($userId, $courseItemId)
{
if ($userId == \TTO::getUserId() || \TTO::getRole() == 'admin') {
$statement = '
SELECT UCI.*, CI.*, I.code, I.content, I.itemGroupId
FROM course_item AS CI
INNER JOIN item AS I
ON CI.itemId = I.itemId
LEFT OUTER JOIN user_course_item AS UCI
ON UCI.courseItemId = CI.courseItemId
AND UCI.userId = :userId
WHERE CI.courseItemId = :courseItemId
';
$bind = array('courseItemId' => $courseItemId, 'userId' => $userId);
$response = \Db::getRow($statement, $bind);
$itemId = $response['itemId'];
$userCourseItemId = $response['userCourseItemId'];
$response += array('allItemDetail' => array());
$statement = '
SELECT UCID.*, ID.*
FROM item_detail AS ID
LEFT OUTER JOIN user_course_item_detail AS UCID
ON UCID.itemDetailId = ID.itemDetailId
AND UCID.userCourseItemId = :userCourseItemId
WHERE itemId = :itemId
ORDER BY seq
';
$bind = array('itemId' => $itemId, 'userCourseItemId' => $userCourseItemId);
$allItemDetail = \Db::getResult($statement, $bind);
foreach ($allItemDetail as $itemDetail) {
if ($itemDetail['itemTypeId'] == 1) {
if ($itemDetail['status'] == 'done') {
$statement = '
SELECT itemRadioId FROM user_course_item_radio
WHERE userCourseItemId = :userCourseItemId
AND itemDetailId = :itemDetailId
';
$bind = array('userCourseItemId' => $userCourseItemId, 'itemDetailId' => $itemDetail['itemDetailId']);
$userItemRadioId = \Db::getValue($statement, $bind);
$itemDetail += array('userItemRadioId' => $userItemRadioId);
}
$statement = 'SELECT * FROM item_radio WHERE itemDetailId = :itemDetailId';
$bind = array('itemDetailId' => $itemDetail['itemDetailId']);
$allItemRadio = \Db::getResult($statement, $bind);
$itemDetail += array('allItemRadio' => $allItemRadio);
}
if ($itemDetail['itemTypeId'] == 3) {
$statement = '
SELECT IDS.*, UCIS.userIsAnswer
FROM item_select AS IDS
LEFT OUTER JOIN user_course_item_select AS UCIS
ON IDS.itemSelectId = UCIS.itemSelectId
AND IDS.itemDetailId = UCIS.itemDetailId
AND UCIS.userCourseItemId = :userCourseItemId
WHERE IDS.itemDetailId = :itemDetailId
';
$bind = array('itemDetailId' => $itemDetail['itemDetailId'], 'userCourseItemId' => $userCourseItemId);
$allItemSelect = \Db::getResult($statement, $bind);
$itemDetail += array('allItemSelect' => $allItemSelect);
}
if ($itemDetail['itemTypeId'] == 4) {
$statement = '
SELECT II.*, UCII.userAnswer
FROM item_input AS II
LEFT OUTER JOIN user_course_item_input AS UCII
ON II.itemInputId = UCII.itemInputId
AND II.itemDetailId = UCII.itemDetailId
AND UCII.userCourseItemId = :userCourseItemId
WHERE II.itemDetailId = :itemDetailId
';
$bind = array('itemDetailId' => $itemDetail['itemDetailId'], 'userCourseItemId' => $userCourseItemId);
$allItemInput = \Db::getResult($statement, $bind);
$itemDetail += array('allItemInput' => $allItemInput);
}
$response['allItemDetail'][] = $itemDetail;
}
return $response;
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例13: getAllItemGroup
/**
* @url GET allitemgroup
*/
protected function getAllItemGroup()
{
$statement = 'SELECT * FROM item_group';
$response = \Db::getResult($statement);
return $response;
}
示例14:
<?php
/**
* Created by JetBrains PhpStorm.
* User: jwfoxjr
* Date: 8/28/11
* Time: 12:29 AM
* To change this template use File | Settings | File Templates.
*/
require_once 'Db.php';
/*** Setup our Connection */
//
Db::setConnectionInfo('fundsmaster', 'root', '#--5ql4dm1n--#', 'mysql', 'localhost');
$q = $_GET['q'];
/*** prepare the SQL statement ***/
$sql = 'SELECT house, street, apt, id FROM address WHERE street="' . $q . '" ORDER BY house,apt ASC';
$result = Db::getResult($sql);
echo '<select size="5">';
/*** loop of the results ***/
foreach ($result as $key => $house) {
echo '<option name="' . $house['id'] . '" value="' . $house['id'] . '">' . $house['house'] . ' ' . $house['street'] . ' ' . $house['apt'] . '</option>';
}
示例15: getAllPackage
/**
* @url GET
* @url GET allpackage
*/
protected function getAllPackage()
{
$statement = 'SELECT * FROM coin WHERE status = :status ORDER BY amount';
$bind = array('status' => 'active');
return \Db::getResult($statement, $bind);
}