?
Path : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/process/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/process/search.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); foreach(${"_" . $_SERVER["REQUEST_METHOD"]} as $k=>$v) $$k=$v; $sql_01 ="SELECT * FROM $selitem where TB_NAME='$TB' "; $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 />ผิดพลาดที่คำสั่ง SQL : ' . $sql_error['message']; echo $debug_text."<br>"; } $sql_02 ="select * from ".$selitem."_fields where TB_NAME='$TB'"; $result_02 = $db_tm->sql_query("SET NAMES utf8"); $result_02 = $db_tm->sql_query($sql_02); $rows_02 = $db_tm->sql_fetchrow($result_02); $sql = $rows_01[SQL]." WHERE 0"; $result = $db_tm->sql_query($sql); $numrows = $db_tm->sql_numrows($result); $numfield = $db_tm->sql_numfields($result); $sql_error = $db_tm->sql_error($result); $debug_text = ''; if ( $sql_error['message'] != '' ){ $debug_text .= '<br /><br />ผิดพลาดที่คำสั่ง SQL : ' . $sql_error['message']."<br>".$sql; echo $debug_text."<br>"; } for($a=0; $a<$numfield;$a++){ $fieldsname = $db_tm->sql_fieldname($offset=$a,$result); $f_name .= "<option value=\"".$rows_02["C".$a]."\">".$fieldsname."</option>"; } $template->set_filenames(array('body' =>'search.tpl')); $template->assign_vars(array( "CUR_HOST_BACKEND"=>$cur_host_backend, "IMAGES_PATH" => $images_path, "STYLE" => STYLE, "INCLUDES_PATH" => $includes_path, "TITLE" => ".:: Search ::.", "TABLE" => $table, "F_NAME" => $f_name, "TB" => $TB, "TBTH" => $TBTH, "SELITEM" => $selitem)); $template->pparse('body'); ?>