<? $host = "localhost"; $user = "root"; $pass = "1234"; $dbname = "govex"; $dbconn = mysql_connect($host,$user,$pass) or die("ติดต่อฐานข้อมูลไม่ได้"); mysql_select_db($dbname,$dbconn); mysql_query("SET NAMES UTF8"); ?> <!--connect_db--------------------------------------------------------------------------------------> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>โปรลองๆ</title> <script type="text/javascript"> function scrUP() { var keyx=document.getElementById('textscr').value; } </script> </head> <body> <br /> <input name="textscr" type="text" id="textscr" placeholder="ระบุชื่อกระทรวงของท่าน" onkeyup="scrUP()"> <br /><br /> <? $sql = "SELECT * FROM govdata WHERE gob LIKE '%$keyx%' "; $objquery = mysql_query($sql,$dbconn); $row = mysql_num_rows($objquery); echo "<table class='SELECT' border='1'> <tr> <th width='60'>ลำดับที่</th> <th width='160'>กระทรวง</th> <th width='160'>กรม</th> <th width='210'>ชื่อหน่วยงาน</th> </tr> "; if ($row<>0){ while ($r = mysql_fetch_array($objquery)){ $rn1 = $r['rn']; $gob1 = $r['gob']; $gom1 = $r['gom']; $gos1 = $r['gos']; echo "<tr>"; echo"<td align='center'>".$r['rn']."</td>"; echo"<td>".$r['gob']."</td>"; echo"<td>".$r['gom']."</td>"; echo"<td>".$r['gos']."</td>"; echo "</tr>"; } echo "</table>"; } else{ echo "ไม่พบข้อมูล"; } mysql_close($dbconn); ?> <!--show data table--------------------------------------------------------------------------------------> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง