ช่วยดูโค้ด ตรงนี้ให้หน่อยค่ะ ว่าจะเพิ่มการแสดงผลตามประเภทสินค้าต้องเพิ่มโค้ดอะไรตรงไหน
ยาวมาก แนะนำนะครับ เวลาจะเอาโค้ดมาลงถ้ายาวแบบนี้ โปรดเลือก Tag สำหรับ PHP ด้วยนะครับ จะได้ดูง่ายๆ ขึ้น
Date :
2011-05-06 12:07:27
By :
ppanchai
Code (PHP)
<?
include("connect.php");
switch(true)
{
case $select=="name":
$SQL="select * from product where pro_name like '%$search%' ";
break;
case $select=="detail":
$SQL="select * from product where pro_id like '%$search%' ";
break;
default:
$SQL="select * from product ";
break;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Ãкº¨Ñ´¡ÒÃÊÔ¹¤éÒ</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
.style3 {font-size: 12px}
.style9 {font-size: 9px; font-family: "MS Sans Serif", Tahoma, sans-serif;}
.style15 {
font-size: 9px;
font-family: "Microsoft Sans Serif";
font-weight: bold;
}
.style16 {font-family: "Microsoft Sans Serif"}
-->
</style>
</head>
<body>
<form name="form1" method="get" action="adminmenuproduct.php">
<p align="center"><span class="detalbody"><b><br>
</b></span> <span class="detalbody"><b> </b></span><span class="style9">¨Ó¹Ç¹·Ñé§ËÁ´
<?
$result = mysql_query($SQL) or die(error_msg(mysql_error(),$SQL));
$number1 = mysql_num_rows($result);
if($number1>0) {
$qty=3;
if($page=="") {
$page = 1;
} else {
$page = $page;
}
$limit = " limit ".(($page-1)*$qty).",".($qty);
$lum=(($page-1)*$qty);
if($number1>0) {
if(($number1%$qty)>0) { $totalpage = (intval($number1/$qty))+1; }
else { $totalpage = ($number1/$qty); }
}
}
?>
<?=$number1?>
ÃÒ¡Òà <
<? if($page>1) { ?>
<a href="?page=<?=($page-1)?>&select=<?=$select?>&search=<?=$search?>">Âé͹¡ÅѺ</a> |
<? } else { ?>
Âé͹¡ÅѺ |
<? } ?>
<? for($i=1;$i<=$totalpage;$i++) { ?>
<a href="?page=<?=$i?>&select=<?=$select?>&search=<?=$search?> "red":"#000000"?>
<?=$i?>
</a> |
<? } ?>
<? if($page<$totalpage) { ?>
<a href="?page=<?=($page+1)?>&select=<?=$select?>&search=<?=$search?>">µèÍä»</a>
<? } else { ?>
µèÍä»
<? } ?>
></font></span></p>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="pink">
<tr>
<td width="12"> </td>
<td width="773" background="../images/top.jpg"><font face="MS Sans Serif" size="2"><b>
</b></font></td>
<td width="12"></td>
</tr>
<tr>
<td width="12" background=""> </td>
<td width="773" align="left" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" background="bgtable/weblcct1_51.gif" class="style9"><span class="style9"> ÅӴѺ·Õè</span></td>
<td width="60%" class="style9"> </td>
</tr>
<?
$result = mysql_query($SQL) or die(error_msg(mysql_error(),$SQL));
$number = mysql_num_rows($result);
$i=1;
while ( $arr=mysql_fetch_array($result))
{
?>
<tr>
<td width="6%" align="right" valign="top" class="style9">
<div align="center" class="style16"><span class="style3">
<? echo $i + (($page-1)*$qty ); ?>
</span></div> </td>
<td width="34%" valign="top" class="style9"><div align="center" class="style16"> <span class="style3"><a href="viewproduct.php?product_id=<?php echo $arr['pro_id'];?>">
<img src='photo/<?=$arr["pro_image"]?>' width="100" height="100" border="0"></a>
<br>
</span></div></td>
<td width="60%" align="left" valign="top" class="style9">
<table width="114%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" align="right" valign="top" class="style9">
<div align="right"> <span class="style9"><b><font size="-3">ÃËÑÊ
</font></b></span><b><font size="-3"> <span class="style9">: </span></font></b></div> </td>
<td width="1%"> </td>
<td width="79%" align="left" valign="top"><span class="style3">
<font size="-3">
<?=$arr["pro_id"];?>
</font></span></td>
</tr>
<tr>
<td width="20%" align="right" valign="top" class="style9">
<div align="right"> <b><font size="-3"><span class="style9">ª×èÍÊÔ¹¤éÒ
: </span></font></b></div> </td>
<td width="1%"> </td>
<td width="79%" align="left" valign="top"><span class="style3">
<font size="-3">
<?=$arr["pro_title"];?>
</font></span></td>
</tr>
<tr>
<td width="20%" align="right" valign="top" class="style9">
<div align="right"> <b><font size="-3"><span class="style9">¨Ó¹Ç¹
: </span></font></b></div> </td>
<td width="1%"> </td>
<td width="79%" align="left" valign="top"><span class="style3">
<font size="-3">
<?=$arr["pro_unit"];?>
</font></span></td>
</tr>
<tr>
<td width="20%" height="17" align="right" valign="top" class="style9">
<div align="right"> <b><font size="-3"><span class="style9">ÃÒ¤Ò
: </span></font></b></div> </td>
<td width="1%" height="17"> </td>
<td width="79%" height="17" align="left" valign="top"><span class="style3">
<font size="-3">
<?=$arr["pro_price"];?>
</font></span></td>
</tr>
<tr>
<td height="22"> </td>
<td height="22" colspan="2" valign="top"> </td>
</tr>
<tr>
<td width="20%" height="22"> </td>
<td height="22" colspan="2" valign="top"><table width="200" border="0" cellspacing="0" cellpadding="0">
</table> </td>
</tr>
</table> </td>
</tr>
<tr>
<td width="6%" height="27" background="bgtable/weblcct1_51.gif" class="style9"> </td>
<td width="34%" height="27" background="bgtable/weblcct1_51.gif" class="style9"><span class="style16"></span></td>
<td width="60%" height="27" background="bgtable/weblcct1_51.gif" class="style9"><span class="style16"></span></td>
</tr>
<?
$i++;
}
?>
</table>
<span class="style3"></span>
</font>[¤é¹ËÒ¢éÍÁÙÅ
]</font></span> <font face="MS Sans Serif">
<font face="MS Sans Serif">
<select name="select">
<option value="name">ÊÔ¹¤éÒ</option>
<option value="detail">ÃËÑÊÊÔ¹¤éÒ</option>
</select>
</font>
<input name="search" type="text" size="30" maxlength="30">
<input type="submit" name="Submit" value="search">
</font></span> </div>
<div align="center"><font face="MS Sans Serif"><span class="style3"></span></font></div> </td>
<td width="12" background="../images/sideright.jpg"> </td>
</tr>
<tr>
<td width="12"> </td>
<td width="773" background="../images/bottom.jpg">
<div align="center"><font face="MS Sans Serif" size="2"></font></div> </td>
<td width="12"> </td>
</tr>
</table>
</form>
</body>
</html>
Date :
2011-05-06 12:13:39
By :
myminthom
ขอโทดค่ะ ไม่รู้จริงๆ
Date :
2011-05-06 12:14:21
By :
myminthom
Load balance : Server 04