?
Path : /home/admin/public_html/old/backoffice/process/ |
Current File : /home/admin/public_html/old/backoffice/process/game_matching.php |
<?php $root_path="../"; include($root_path."header.php"); $db_tm=new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); $template= new Template($process_tpl_path); $result_group_tb=$db_tm->sql_query("SET NAMES utf8"); $result_group_tb=$db_tm->sql_query("SELECT group_data.TB_NAME_TH FROM group_data WHERE group_data.TB_NAME = '".$TB."'"); $rows=$db_tm->sql_fetchrow($result_group_tb); $TBTH=$rows[TB_NAME_TH]; $result_game_zone=$db_tm->sql_query("SET NAMES utf8"); $result_game_zone=$db_tm->sql_query("SELECT * FROM game_zone order by id asc"); $num_game_zone=$db_tm->sql_numrows($result_game_zone); $sel_game_zone='<select name="game_zone_id" id="game_zone_id">'; for($i=0;$i<$num_game_zone;$i++){ $rows_game_zone=$db_tm->sql_fetchrow($result_game_zone); $sel_game_zone.='<option value="'.$rows_game_zone["id"].'" {sel_item}>'.$rows_game_zone["name"].'</option>'; } $sel_game_zone.='</select>'; if($flag=="add"){ $title="Add "; $image="../images/spacer.gif"; } if($flag=="edit"){ $title="Edit "; $idx_data = split('`',$index_data); $sql = "SELECT SQL_TB FROM $selitem where TB_NAME='$TB' "; $result = $db_tm->sql_query("SET NAMES utf8"); $result = $db_tm->sql_query($sql); $rows = $db_tm->sql_fetchrow($result); $sql_error = $db_tm->sql_error($result); $debug_text = ''; if ( $sql_error['message'] != '' ){ $debug_text .= '<br /><br />Error command SQL : ' . $sql_error['message']; echo $debug_text."<br>"; } $result_00 = $db_tm->sql_query("select * from $TB where 0"); $first_fields = $db_tm->sql_fieldname($offset=0,$result_00); $sql_01 = $rows[SQL_TB]." where $first_fields='$idx_data[0]' "; $result_01 = $db_tm->sql_query("SET NAMES utf8"); $result_01 = $db_tm->sql_query($sql_01); $rows_01 = $db_tm->sql_fetchrow($result_01); $sql_error = $db_tm->sql_error($result_01); $debug_text = ''; if ( $sql_error['message'] != '' ){ $debug_text .= '<br /><br />Error command SQL : ' . $sql_error['message']; echo $debug_text."<br>"; } $id=$rows_01['id']; $game_zone_id=$rows_01['game_zone_id']; $img_path=$rows_01['img_path']; $image=($img_path!="" && is_file("../../game_zone/images_game_matching/".$img_path))? "../../game_zone/images_game_matching/".$img_path:"../images/spacer.gif"; $result_game_zone=$db_tm->sql_query("SET NAMES utf8"); $result_game_zone=$db_tm->sql_query("SELECT * FROM game_zone where id='".$game_zone_id."'"); $sel_item=" selected "; } $template->set_filenames(array('body' =>'game_matching.tpl')); $template->assign_vars(array( "STYLE" =>STYLE, "TITLE" =>$title, "FLAG" =>$flag, "TB" =>$TB, "TBTH" =>$TBTH, "SELITEM" =>$selitem, "IMAGES_PATH" =>$images_path, "INCLUDES_PATH" =>$includes_path, "Image" =>$image, "id"=>$id, "game_zone_id"=>$game_zone_id, "sel_game_zone"=>$sel_game_zone, "sel_item"=>$sel_item, "img_path"=>$img_path, "Image"=>$image, )); $template->pparse('body'); ?>