本文整理匯總了PHP中User_Model::selectWhere方法的典型用法代碼示例。如果您正苦於以下問題:PHP User_Model::selectWhere方法的具體用法?PHP User_Model::selectWhere怎麽用?PHP User_Model::selectWhere使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類User_Model
的用法示例。
在下文中一共展示了User_Model::selectWhere方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: join
/**
* User join in class
* @return [type] [description]
*/
function join()
{
if (!isset($_POST['submit'])) {
echo json_encode("failed");
exit;
}
$data = array();
$data['class_id'] = $_POST['class_id'];
$data['user_id'] = $_POST['user_id'];
if (count($data) == 0) {
echo json_encode("failed");
exit;
}
$UserClassModel = new User_Class_Model();
$UserModel = new User_Model();
$class_id = $data['class_id'];
$user_id = $data['user_id'];
$isAttend = ${$UserClassModel}->selectWhere('*', "class_id = '{$class_id}' and user_id = '{$user_id}'");
$isExistClass = $this->selectWhere('*', "id = '{$class_id}'");
$isExistUser = $UserModel->selectWhere('*', "id = '{$user_id}'");
if (isset($isAttend)) {
echo json_encode(array("failed", 'message' => 'You are attend this class!'));
exit;
}
if (!isset($isExistClass) || !isset($isExistUser)) {
echo json_encode(array("failed", 'message' => 'Class or user not exist!'));
exit;
}
$arrTemp = array();
foreach ($data as $key => $value) {
$arrTemp[$key] = $key . "=" . "'{$value}'";
}
if ($UserClassModel->insert($data)) {
echo json_encode(array("success", $data['id']));
} else {
echo json_encode("failed");
}
}