本文整理汇总了PHP中DBModel::insertDB方法的典型用法代码示例。如果您正苦于以下问题:PHP DBModel::insertDB方法的具体用法?PHP DBModel::insertDB怎么用?PHP DBModel::insertDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBModel
的用法示例。
在下文中一共展示了DBModel::insertDB方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($year)
{
if (!isset($year)) {
$year = ContestModel::getCurrentYear();
}
$this->year = $year;
$cond['id'] = $year;
if (!DBModel::existUser('cernet_contest', $cond)) {
DBModel::insertDB('cernet_contest', $cond);
}
}
示例2: storeAward
/**
* store the men and the teams in the table--second_award
* @author panda
*/
public function storeAward()
{
$year = ContestModel::getCurrentYear();
$tables = ['cernet_user', 'cernet_team', 'cernet_teacher'];
$model = new DBModel();
for ($i = 0; $i < 3; $i++) {
$users = $model->getAward($tables[$i]);
foreach ($users as $user) {
$data = array('user_type' => $i, 'user_id' => $user['id'], 'award' => $user['prize'], 'contest_id' => $year);
$model->insertDB('second_award', $data);
}
}
}
示例3: new_report_
public function new_report_()
{
eval(USER);
$data = $_POST;
unset($data['__hash__']);
$data['id'] = $this->generateReportId();
DBModel::insertDB('cernet_report', $data);
$data_['report_id'] = $data['id'];
$cond['id'] = DBModel::getTeamByUser(session('userid'));
DBModel::updateDB('cernet_team', $cond, $data_);
$this->assign('waitSecond', 1);
$this->success(Success('publish'), '__ROOT__/Index/report_list');
}
示例4: register_
/**
* Register handle function.
* Usertype: Student
*/
public function register_()
{
try {
$this->assign('waitSecond', 2);
$data['username'] = safepost('username');
$pwd = safepost('password');
if (!DBModel::existUser('cernet_user', $data) && !DBModel::existUser('second_user', $data)) {
$data = trimarray($_POST);
unset($data['__hash__']);
$data['password'] = encrypt($pwd);
$data['id'] = $this->generateStudentId();
DBModel::insertDB('cernet_user', $data);
$this->success(Success('register'), '__ROOT__');
} else {
# Error Tips
$this->error(Error('register'), lastpage());
}
} catch (Exception $e) {
throw_exception($e->getMessage());
}
}
示例5: modify_tutor_
/**
* Create || Modify a tutor.
*/
public function modify_tutor_()
{
eval(ADMIN);
try {
$data["name"] = safepost("name");
$data["mobile"] = safepost("mobile");
$data["email"] = safepost("email");
$cond["id"] = safepost("id");
if ($cond['id'] != '') {
DBModel::updateDB('cernet_tutor', $cond, $data);
} else {
DBModel::insertDB('cernet_tutor', $data);
$tutor = DBModel::getByFields('cernet_tutor', $data);
$tutor = $tutor[0];
$cond['id'] = $tutor['id'];
$team_id = safepost("team_id");
DBModel::updateDB('cernet_team', $cond, array('tutor_id' => $team_id));
}
goback();
} catch (Exception $e) {
throw_exception($e->getMessage());
}
}