当前位置: 首页>>代码示例>>PHP>>正文


PHP DbHandler::getUserById方法代码示例

本文整理汇总了PHP中DbHandler::getUserById方法的典型用法代码示例。如果您正苦于以下问题:PHP DbHandler::getUserById方法的具体用法?PHP DbHandler::getUserById怎么用?PHP DbHandler::getUserById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbHandler的用法示例。


在下文中一共展示了DbHandler::getUserById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: field

    } else {
        // user credentials are wrong
        $response['error'] = true;
        $response['message'] = 'One or more field(s) missing or invalid';
    }
    echoResponse(200, $response);
});
$app->post('/unfollowlocation', function () use($app) {
    $locationId = $app->request()->post('locationId');
    $followerId = $app->request()->post('followerId');
    $response = array();
    $db = new DbHandler();
    // check for correct email and password
    if ($db->unfollowLocation($locationId, $followerId)) {
        // get the user by email
        $user = $db->getUserById($followerId);
        $location = $db->getLocation($locationId);
        if ($user != NULL && $location != NULL) {
            $response["error"] = false;
            //            $response['message'] = "New Update Added for the route $location1-$location2";
            $response['message'] = "Location Follower Removed";
        } else {
            // unknown error occurred
            $response['error'] = true;
            $response['message'] = "An error occurred. Please try again.";
        }
    } else {
        // user credentials are wrong
        $response['error'] = true;
        $response['message'] = 'One or more field(s) missing or invalid';
    }
开发者ID:WasifurRahman,项目名称:TrafficApp,代码行数:31,代码来源:index.php

示例2: echoRespnse

    }
    // echo json response
    echoRespnse(201, $response);
});
$app->post('/addSpotRequest', function () use($app) {
    verifyRequiredParams(array('userId', 'spotName', 'regionName', 'country'));
    $response = array();
    // reading post params
    //$email = $app->request()->post('email');
    //$user_id = $app->request()->post('userId');
    $spotName = $app->request()->post('spotName');
    $regionName = $app->request()->post('regionName');
    $country = $app->request()->post('country');
    //global $user_id;
    $db = new DbHandler();
    $user = $db->getUserById($user_id);
    global $EmailAdmin;
    global $EmailFrom;
    $EmailTo = $EmailAdmin;
    $Subject = "A user has submitted a request to Add a Spot";
    // prepare email body text
    $Body = "";
    $Body .= "Country: {$country}";
    $Body .= "\n";
    $Body .= "Region: {$regionName}";
    $Body .= "\n";
    $Body .= "Spot Name: {$spotName}";
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Username  = " . $user["username"];
    $Body .= "\n";
开发者ID:AshKetchumza,项目名称:Wavey,代码行数:31,代码来源:index.php


注:本文中的DbHandler::getUserById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。