รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

rukturna
PHP Full Member
PHP Full Member
โพสต์: 47
ลงทะเบียนเมื่อ: 02/09/2010 8:55 pm

รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย rukturna »

ผมรบกวนท่านดูโค้ดตรงนี้หน่อยคับ
เค้าเขียนไว้สำหรับ ค้นหา คำถามผมคือ แล้วเค้าไม่ต้องเชื่อมกะฐานข้อมูลหรือคับ

โค้ด: เลือกทั้งหมด


<?
$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">ค้นหาข้อมูล :&nbsp;<input class=box name=keyWordSearch value=<?=$pkeywordsearch?>>
		&nbsp;
		<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">&nbsp;<br>		
		</Td>
		</Tr>
		<tr>
        <td colspan=15>&nbsp; </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">รวม&nbsp;&nbsp; <?print"	$i";?>&nbsp;&nbsp;รายการ</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='ลบ' 
$LU กะ $LD คืออะไรรือคับ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41410
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ตัวแปลที่สร้างขึ้น และเก็บค่า <a her=....;
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
rukturna
PHP Full Member
PHP Full Member
โพสต์: 47
ลงทะเบียนเมื่อ: 02/09/2010 8:55 pm

Re: รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย rukturna »

แล้วโค้ดดังกล่าว ไม่ได้มีการเชื่อมต่อไปยัง ฐานข้อมูลรือคับ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41410
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

มันอยู่ใน Loop

โค้ด: เลือกทั้งหมด

while( $row = mysql_fetch_assoc($TB->result) ){ 
ซึ่ง result มาจากข้อมูลอยู่แล้วครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
rukturna
PHP Full Member
PHP Full Member
โพสต์: 47
ลงทะเบียนเมื่อ: 02/09/2010 8:55 pm

Re: รบกวนดูโค้ดสำหรับค้นหาหน่อยคับ ผม งง ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย rukturna »

แล้วเงื่อนไขในการค้นหาคือตรงไหนรือคับ
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: Google Adsense [Bot], Majestic-12 [Bot] และบุคลทั่วไป 92