|
|
|
สอบถามการสร้างฟอร์มค้นหาจาก MySQL พร้อมโค๊ด ขอบคุณครับ |
|
|
|
|
|
|
|
Code (PHP)
....
....
<?php
$objConnect = mysql_connect("xxx","xxx","xxx") or die("Error Connect to Database");
$objDB = mysql_select_db("xxx");
mysql_query('SET NAMES utf8');
?>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="text" name="txtSearch" value="<?=$_POST["txtSearch"];?>"/>
<input type="submit" name="btnSubmit" value="Search"/>
</form>
<?php
$strSQL = "SELECT * FROM san";
if(isset($_POST['btnSubmit'])){
$strSQL .= " WHERE san.NAME LIKE '%".trim($_POST["txtSearch"])."%'";
}
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
....
....
|
|
|
|
|
Date :
2015-02-02 22:41:00 |
By :
sabaitip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|