?
Path : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/user/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/user/search.php |
<?php $root_path="../"; include($root_path."header.php"); $db_tm = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); $template = new Template($user_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($sql_02); $rows_02 = $db_tm->sql_fetchrow($result_02); $sql = $rows_01[SQL]." WHERE 0"; list($usec,$sec)=explode(' ',microtime()); $time_before=((float)$usec+(float)$sec); $result = $db_tm->sql_query($sql); list($usec,$sec)=explode(' ',microtime()); $time_after=((float)$usec+(float)$sec); //echo "ใช้เวลาค้นหา : ",sprintf("%.3f",$time_after-$time_before)," วินาที่"; $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("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'); ?>