$host="localhost"; $username="root"; $password=""; $db_name="db"; $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); $q = strtolower($_GET["q"]); if (!$q) return; $sql = "select DISTINCT emp_firstname as emp_firstname from temployee where emp_firstname LIKE '%$q%'"; $rsd = mysql_query($sql) or die(mysql_error().":<br />".$sql_select) ; while($rs = mysql_fetch_array($rsd)) { $cname = $rs['emp_firstname']; echo "$cname\n"; }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <link href="style.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type='text/javascript' src="js/jquery.autocomplete.js"></script> <link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" /> <script type="text/javascript"> $().ready(function() { $("#position1_name").autocomplete("autoCompleteMain.php", { width: 260, matchContains: true, selectFirst: false }); }); </script> <form id="form1" name="form1" method="post" action="form_m2_save.php" enctype="multipart/form-data" onSubmit="return validate(this);" autocomplete="on"> <input type="text" size="40" maxlength="90" id="position1_name" name="position1_name" value="" placeholder="ชื่อพนักงาน"/>
$host="localhost"; $username="root"; $password=""; $db_name="mydb"; mysql_query("SET character_set_results=tis620"); mysql_query("SET character_set_client=tis620"); mysql_query("SET character_set_connection=tis620"); $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); $q = strtolower($_GET["q"]); if (!$q) return; $sql = "select DISTINCT emp_firstname as emp_firstname from temployee where emp_firstname LIKE '%$q%'"; $rsd = mysql_query($sql) or die(mysql_error().":<br />".$sql_select) ; while($rs = mysql_fetch_array($rsd)) { $cname = $rs['emp_firstname']; echo "$cname\n"; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง