/** * 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); } } }