<? require("connect.php"); connectdb("orderdb"); $sql = "select * from product order by pid"; mysql_query("set names tis620"); $result = mysql_query($sql); ?> <? while ($row = mysql_fetch_array($result)) { ?> <div style="float:left"><table width="232" height="501" border="2"> <tr> <td height="177" colspan="2" align="center" bgcolor="#FFFFFF"><img src="<?=$row[pic]?>" width="170" height="150"/></td> <td height="177" colspan="2" align="center" bgcolor="#FFFFFF"><img src="<?=$row[pic]?>" width="170" height="150"/></td> </tr> <tr> <td height="33" colspan="2" align="center" bgcolor="#666666"><?=$row["Pid"]?></td> <td height="33" colspan="2" align="center" bgcolor="#666666"><?=$row["Pid"]?></td> </tr> <tr> <td height="60" colspan="2" align="center" bgcolor="#666666"><?=$row["Pname"]?></td> <td height="60" colspan="2" align="center" bgcolor="#666666"><?=$row["Pname"]?></td> </tr> <tr> <td height="64" colspan="2" align="center" bgcolor="#666666"><?=$row["Detail"];?></td> <td height="64" colspan="2" align="center" bgcolor="#666666"><?=$row["Detail"];?></td> </tr> <tr> <td height="35" colspan="2" align="center" bgcolor="#666666"><?=$row["Categories"]?></td> <td height="35" colspan="2" align="center" bgcolor="#666666"><?=$row["Categories"]?></td> </tr> <tr> <td height="35" colspan="2" align="right" bgcolor="#666666"><?=$row["Price"]?> Baht.</td> <td height="35" colspan="2" align="right" bgcolor="#666666"><?=$row["Price"]?> Baht.</td> </tr> <tr> <td width="110" height="49" align="center" bgcolor="#666666"><a href="edit.php?pid=<?=$row[pid]?>" ><img src="Picweb/pic admin/edit.png" width="40" height="40" /></a></td> <td width="104" align="center" bgcolor="#666666"><a href="delete.php?pid=<?=$row[pid]?>" ><img src="Picweb/pic admin/delete.png" width="40" height="40" /></a></td> <td width="110" height="49" align="center" bgcolor="#666666"><a href="edit.php?pid=<?=$row[pid]?>" ><img src="Picweb/pic admin/edit.png" width="40" height="40" /></a></td> <td width="104" align="center" bgcolor="#666666"><a href="delete.php?pid=<?=$row[pid]?>" ><img src="Picweb/pic admin/delete.png" width="40" height="40" /></a></td> </tr> </table></div> <?php } ?>
<a href="product_detail.php?id=<?=$row[pid]?>"> <tabel>...</table> </a>
Quote:เอาลิงค์ไปครอบ table เลยไม่ได้เหรอ <a href="product_detail.php?id=<?=$row[pid]?>"> <tabel>...</table> </a>
$column = 5; $col_id=0; // ค่าเริ่มต้น while($ro=$result->fetch_assoc() ){ if($col_id==0){ echo '<div><table><tr>'; } echo '<td><table>'; echo '<tr><td>'.$ro['field1'].'</td></tr>'; echo '<tr><td>'.$ro['field2'].'</td></tr>'; echo '<tr><td>'.$ro['field3'].'</td></tr>'; echo '<tr><td>'.$ro['field4'].'</td></tr>'; echo '</table><td>'; $col_id++; if($col_id==$column){ echo '</tr></table></div>'; $col_id=0; } } if($col_id){ echo '</tr></table></div>'; }
Quote:ใช้หลักการเดียวกับที่ท่านทำ <a href="edit.php?pid=<?=$row[pid]?>" >แก้ไข</a> นั่นแหละ
<? require("connect.php"); connectdb("orderdb"); $sql = "SELECT * FROM product ORDER BY Pid"; mysql_query("set names tis620"); $result = mysql_query($sql); ?> <? while ($num_column = mysql_fetch_array($result)) { ?> <div style="float:left"><table width="232" height="501" border="2"> <tr> <td height="177" colspan="2" align="center" bgcolor="#FFFFFF"><img src="<?=$num_column["Pic"]?>" width="170" height="150"/></td> </tr> <tr> </tr> <tr> <td height="60" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Pname"]?></td> </tr> <tr> <td height="64" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Detail"];?></td> </tr> <tr> </tr> <tr> <td height="35" colspan="2" align="right" bgcolor="#666666"><?=$num_column["Price"]?> Baht.</td> </tr> <tr> </tr> </table></div> <? } ?>
<? require("connect.php"); connectdb("orderdb"); $sql = "select * from product order by Pid"; mysql_query("set names tis620"); $result = mysql_query($sql); ?> <? while ($num_column = mysql_fetch_array($result)) { ?> <div style="float:left"><table width="232" height="501" border="2"> <tr> <td height="177" colspan="2" align="center" bgcolor="#FFFFFF"><a href="cpudetail.php?id=<?=$num_column["Pid"]?>"><img src="<?=$num_column["Pic"]?>" width="170" height="150"/></a></td> </tr> <tr> <td height="33" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Pid"]?></td> </tr> <tr> <td height="60" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Pname"]?></td> </tr> <tr> <td height="64" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Detail"];?></td> </tr> <tr> <td height="35" colspan="2" align="center" bgcolor="#666666"><?=$num_column["Categories"]?></td> </tr> <tr> <td height="35" colspan="2" align="right" bgcolor="#666666"><?=$num_column["Price"]?> Baht.</td> </tr> <tr> <td width="110" height="49" align="center" bgcolor="#666666"><a href="edit.php?pid=<?=$num_column[Pid]?>" ><img src="Picweb/pic admin/edit.png" width="40" height="40" /></td> <td width="104" align="center" bgcolor="#666666"><a href="delete.php?pid=<?=$num_column[Pid]?>" ><img src="Picweb/pic admin/delete.png" width="40" height="40" /></td> </tr> </table></div> <? } ?>
Quote:$sql = "SELECT * FROM product WHERE pid = $_GET['pid']";
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง