<?php require_once('../Connections/myconnect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_DataSearch = "-1"; if (isset($_GET['word'])) { $colname_DataSearch = $_GET['word']; } mysql_select_db($database_myconnect, $myconnect); $query_DataSearch = sprintf("SELECT * FROM project p JOIN leader l On p.id_leader = l.id_leader WHERE pro_name LIKE %s", GetSQLValueString("%" . $colname_DataSearch . "%", "text")); $DataSearch = mysql_query($query_DataSearch, $myconnect) or die(mysql_error()); $row_DataSearch = mysql_fetch_assoc($DataSearch); $totalRows_DataSearch = mysql_num_rows($DataSearch); ?> <!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>Untitled Document</title> <style type="text/css"> body { background-color: #CFF; } </style> </head> <body> <div align="center"> <p>ค้นหาข้อมูล<br /> </p> </div> <form name="frmSearch" method="get" action="<?php echo $_SERVER['SCRIPT_NAME'];?>"></br> <table width="200" align="center"> <tr> <td align="center"><label> <input type="radio" name="RdoSearch" value="leader_name" id="RdoSearch_0" /> ผู้จัดทำ</label></td> </tr> <tr> <td align="center"><label> <input type="radio" name="RdoSearch" value="pro_name" id="RdoSearch_1" /> ชื่อเรื่อง</label></td> </tr> </table> </br> <div align="center">คำค้น : <input type="text" name="word" id="word" /> <input type="submit" name="btnSearch" id="btnSearch" value="ค้นหา" /> </div> </form> <p align="center"> </p> <table border="1" align="center"> <tr> <td>id_project</td> <td>pro_name</td> <td>id_leader</td> <td>pro_expen</td> <td>pro_date</td> </tr> <?php do { ?> <tr> <td><?php echo $row_DataSearch['id_project']; ?></td> <td><?php echo $row_DataSearch['pro_name']; ?></td> <td><?php echo $row_DataSearch['leader_name']; ?></td> <td><?php echo $row_DataSearch['pro_expen']; ?></td> <td><?php echo $row_DataSearch['pro_date']; ?></td> </tr> <?php } while ($row_DataSearch = mysql_fetch_assoc($DataSearch)); ?> </table> <p align="center"><a href="page.php">กลับหน้าแรก</a></p> <div align="center"> </div> </body> </html> <?php mysql_free_result($DataSearch); ?>
<? $strSQL = "SELECT * FROM table WHERE 1 "; if($_POST["txt1"] != "") { $strSQL .= " AND F1 = '".$_POST["txt1"]."' "; } if($_POST["txt2"] != "") { $strSQL .= " AND F2 = '".$_POST["txt2"]."' "; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง