เค้าเขียนไว้สำหรับ ค้นหา คำถามผมคือ แล้วเค้าไม่ต้องเชื่อมกะฐานข้อมูลหรือคับ
โค้ด: เลือกทั้งหมด
<?
$pkeywordsearch = $_POST["keyWordSearch"];
$pconditionsearch = $_POST["ConditionSearch"];
include ("Connection/connect.php");
include ("db/tbManagerF.php");
$tmp = "cus_id=0";
if ($pkeywordsearch != null ) {
$tmp = $pconditionsearch ." like '%" . $pkeywordsearch ."%' " ;
}
$TB = new tbManagerF(customer);
$TB->get_result($tmp);
?>
<Html>
<Head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="Css/table001.css" type=text/css rel=stylesheet>
</head>
<body>
<form name="FORMS" action=SearchCustomer.php method=post >
<div id="main"><table id=TB cellspacing="0">
<caption><H4>ค้นหาประวัติลูกค้า</H4></caption>
<!-- <caption style="padding-top:10px;padding-bottom:5px;"></caption> -->
<tbody>
<thead>
<tr>
<Td colspan=6 align="left">ค้นหาข้อมูล : <input class=box name=keyWordSearch value=<?=$pkeywordsearch?>>
<SELECT NAME='ConditionSearch' class='box1' >
<OPTION VALUE='cus_Fname' >ชื่อลูกค้า</OPTION>
<OPTION VALUE='cus_Lname' >นามสกุล</OPTION>
<OPTION VALUE='cus_Address' >ที่อยู่</OPTION>
<OPTION VALUE='cus_tel' >เบอร์โทรศัพท์</OPTION>
<OPTION VALUE='cus_mobile' >เบอร์มือถือ</OPTION>
</SELECT>
<input class=button type=button value='ค้นหา' onClick="search()">
<Td colspan=15 align="right"> <br>
</Td>
</Tr>
<tr>
<td colspan=15> </td>
</tr>
<tr>
<th>ลำดับ</th>
<th>รหัสลูกค้า</th>
<th>ชื่อ</th>
<th>นามสกุล</th>
<th>ที่อยู่</th>
<th>เบอร์โทรศัพท์</th>
<th>เบอร์โทรศัพท์มือถือ</th>
<th>เบอร์แฟกซ์</th>
<th>สถานที่ส่งสินค้า</th>
<th>แผนที่</th>
<th>แก้ไข</th>
<th>ลบ</th>
</tr>
</thead>
<?
$i=1;
while( $row = mysql_fetch_assoc($TB->result) ){
$LU = "<a href='CustomerForm.php?cus_id=".$row['cus_id']."&Mode=Update'><Img alt='แก้ไข' src='./ThemeOffice/task_f2.png' width=22 border=0></a>";
$LD = "<a href='CustomerForm.php?cus_id=".$row['cus_id']."&Mode=Delete'><Img alt='ลบ' src='./ThemeOffice/stop_f2.png' width=22 border=0></a>";
$classod = (($i%2)==0 )? "" : " class=odd ";
print "<tr $classod onmouseover='onOver(this)' onmouseout='onOut(this)' >";
print " <td class=sub>$i</td>";
print " <td>".$row['cus_id']."</td>";
print " <td>".$row['cus_Fname']."</td>";
print " <td>".$row['cus_Lname']."</td>";
print " <td>".$row['cus_address']."</td>";
print " <td>".$row['cus_tel']."</td>";
print " <td>".$row['cus_mobile']."</td>";
print " <td>".$row['cus_fax']."</td>";
print " <td>".$row['DeliveryAddress']."</td>";
if ($row['Maplink'] != null )
print " <td align=center><a href='upload/".$row['Maplink']."' target=new><img src='ThemeOffice/globe3.png' alt=".$row['Maplink']." border=0></a></td>";
else
print " <td>".$row['Maplink']."</td>";
print " <td>$LU</td>";
print " <td>$LD</td>";
print "</tr>";
$i++;
}
?>
<tfoot>
<? $i--; ?>
<tr>
<th colspan="17">รวม <?print" $i";?> รายการ</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
</form>
<SCRIPT Language="JavaScript">
function search(){
FORMS.submit();
}
function onOver(obj){
obj.style.background = "#c7d7f3";
}
function onOut(obj){
var color = (obj.className == "odd") ? "#f1f1f1" : "#fafafa";
obj.style.background = color;
}
</SCRIPT>
</body>
</html>
โค้ด: เลือกทั้งหมด
while( $row = mysql_fetch_assoc($TB->result) ){
$LU = "<a href='CustomerForm.php?cus_id=".$row['cus_id']."&Mode=Update'><Img alt='แก้ไข' src='./ThemeOffice/task_f2.png' width=22 border=0></a>";
$LD = "<a href='CustomerForm.php?cus_id=".$row['cus_id']."&Mode=Delete'><Img alt='ลบ'