<? $objConnect = mysql_connect("localhost","root","homyai001") or die("Error Connect to Database"); $objDB = mysql_select_db("smat"); $strSQL = "SELECT *FROM machine where sector like '%drier%'"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> </p> <p>ทั้งหมด ....... แถว ยอดรวมจาก Price เท่ากับ ...... บาท</p> <table width="1063" border="1"> <tr> <th width="50"> <div align="center">Layout</div></th> <th width="500"> <div align="center">Name</div></th> <th width="300"> <div align="center">Price1</div></th> <th width="300"> <div align="center">price2</div></th> <th width="149"> <div align="center">sectar</div></th> <th width="149">ToTal</th> <th width="150"> <div align="center">Edit</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td height="23"><div align="center"><?=$objResult["layout"];?></div></td> <td><center><?=$objResult["name"];?></center></td> <td><center><?=$objResult["price"];?></center></td> <td><center><?=$objResult["reference"];?></center></td> <td><center><?=$objResult["sector"];?></center></td> <td> </td> <td><center> <a href="view.php?layout=<?=$objResult["layout"];?>">detail</a> </center></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> </body> </html>
<?php $db = new mysqli("localhost","root","homyai001", "smat") or die("Error Connect to Database"); $strSQL = "SELECT *FROM machine where sector like '%drier%'"; $rs = $db->query($strSQL) or die ( $db->error . "<br>Error Query [$strSQL]"); $html=''; $total=0; $num_row = $rs->num_rows; while($ro = $rs->fetch_assoc()){ $html .= <<<HTML <tr> <td height="23" align="center">$ro[layout]</td> <td align=center >$ro[name]</td> <td align=center>$ro[price]</td> <td align=center>$ro[reference]</td> <td align=center>$ro[sector]</td> <td> </td> <td align=center ><a href="view.php?layout=$ro[layout]">detail</a></td> </tr> HTML; $total +=$ro['price']; } ?> <p>ทั้งหมด <?=$num_row?> แถว ยอดรวมจาก Price เท่ากับ <?=$total?> บาท</p> <table width="1063" border="1"> <tr> <th width="50"> <div align="center">Layout</div></th> <th width="500"> <div align="center">Name</div></th> <th width="300"> <div align="center">Price1</div></th> <th width="300"> <div align="center">price2</div></th> <th width="149"> <div align="center">sectar</div></th> <th width="149">ToTal</th> <th width="150"> <div align="center">Edit</div></th> </tr> <?=$html?> </table> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง