| Server IP : 61.19.30.66 / Your IP : 216.73.216.80 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/cooperative/ |
Upload File : |
<?php
session_start();
header("Content-Type:text/html; charset=TIS-620");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
$q = iconv("UTF-8", "TIS-620", urldecode($_GET["q"]));
$pagesize = 20; // จำนวนรายการที่ต้องการแสดง
$host = "localhost";
$dbpwd = "klw3322";
$dbuser = "root";
$dbname = "klw";
$dberr = "!.. ไม่สามารถติดต่อฐานข้อมูลได้ในขณะนี้ กรุณาลองใหม่";
$sql ="SELECT * FROM sell_product WHERE (sell_proname LIKE '" . $q . "%') ORDER BY desc ";
$conn = mssql_connect($host, $dbuser, $dbpwd) or die("1." . $dberr);
$selected = mssql_select_db($dbname, $conn) or die("2." . $dberr);
$rst = mssql_query($sql) or die("3." . $qerr . "\n\n" . $sql);
$rows = mssql_num_rows($rst);
if ($rows > 0) {
$ends = $rows;
if ($rows > $pagesize) {$ends = $pagesize;}
for ($i = 1; $i <= $ends; $i++) {
$id = mssql_result($rst, $i-1, "sell_proid"); // ฟิลที่ต้องการส่งค่ากลับ
$name = ucwords(strtolower(mssql_result($rst, $i-1, "desc"))); // ฟิลที่ต้องการแสดงค่า
// ป้องกันเครื่องหมาย '
$name = str_replace("'", "'", $name);
// กำหนดตัวหนาให้กับคำที่มีการพิมพ์
$display_name = preg_replace("/(" . $q . ")/i", "<b>$1</b>", $name);
echo "<li onselect=\"this.setText('$name').setValue('$id');\">$display_name</li>";
}
}
mssql_close($conn);
?>