query("SELECT * FROM setting_difficulty WHERE difficulty_id = '".$difficulty_id."' LIMIT 1"); if ($mysqli_page->num_rows > 0){ // keep query value in array $row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ; $submit_type = 'edit' ; } // update database if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){ // keep value in variable $page_title = escapeString($_POST['title']) ; $page_title = ($page_title != '' ? $page_title : 'No Title') ; if ( $difficulty_id == '' ){ $mysqli->query( "INSERT INTO setting_difficulty ( created_at ) VALUES ( '".TODAYDATE."' )" ) ; $difficulty_id = $mysqli->insert_id ; } $set_tier = [] ; foreach ( $_POST['set_tier'] as $k => $v ){ $set_tier[] = $v ; } // update database $mysqli->query( "UPDATE setting_difficulty SET code = '".escapeString($_POST['code'])."', set_tier = '|".implode( '|', $set_tier )."|' WHERE difficulty_id = '".$difficulty_id."'" ) ; foreach ( $LANGS as $klang => $vlang ){ $title = escapeString( $_POST['title_'.$klang] ) ; checkLangUpdate( 'setting_difficulty_translation', 'difficulty_id', $difficulty_id, $klang, [ 'title' => [ 'type' => 'input', 'value' => $title ] ] ) ; } // refresh page header("Location:app-difficulty.php?page_mode=edit&difficulty_id=".$difficulty_id."&success=1") ; $_SESSION['system_result'] = 'success-updated' ; exit ; } if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'app-difficulty-new') ) && $page_mode == 'edit' ){ header('Location: app-difficulty.php') ; exit ; } // get all requires // get all tier $tier_list = [] ; $mysqli_tier = $mysqli->query("SELECT a.tier_id, b.title FROM profile_tier a LEFT JOIN profile_tier_translation b ON ( a.tier_id = b.tier_id ) WHERE a.deleted_at IS NULL AND b.lang = 'en' ORDER BY a.sortable ASC") ; if ( $mysqli_tier->num_rows > 0 ){ while ( $row_tier = $mysqli_tier->fetch_assoc() ){ $tier_list[] = $row_tier ; } } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>