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