本文整理汇总了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';
}
示例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";