<html> <head> <title>ThaiCreate.Com</title> </head> <body> <a href="NewQuestion.php">New Topic</a> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM webboard "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 10; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="909" border="1"> <tr> <th width="99"> <div align="center">QuestionID</div></th> <th width="458"> <div align="center">Question</div></th> <th width="90"> <div align="center">Name</div></th> <th width="130"> <div align="center">CreateDate</div></th> <th width="45"> <div align="center">View</div></th> <th width="47"> <div align="center">Reply</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> ///ตรงนี้ผมต้องการให้เเสดงภาพ <img src="myfile/<?=$objResult["FilesName"];?>"> โดยใช้โค๊ดตัวนี้ได้ไหมครับ ดึงจากฐาน img $strSQL = "SELECT * FROM img "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ไม่ทราบว่าต้องใช้คำสั่งอะไรมั่งครับ พอลองหลายๆอย่างมันไม่ยอมขึ้น ส่วนภาพผมอัพโหลดเกบเข้า sqlเเล้ว <td><div align="center"><?=$objResult["QuestionID"];?></div></td> <td><a href="ViewWebboard.php?QuestionID=<?=$objResult["QuestionID"];?>"><?=$objResult["Question"];?></a></td> <td><?=$objResult["Name"];?></td> <td><div align="center"><?=$objResult["CreateDate"];?></div></td> <td align="right"><?=$objResult["View"];?></td> <td align="right"><?=$objResult["Reply"];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } mysql_close($objConnect); ?> </body> </html>
<table id="table" class="table table-hover table-mc-light-blue"> <thead> <tr> <th>ลำดับที่</th> <th>เรื่อง</th> <th>โดย</th> <th>เมื่อวันที่</th> <th>ดู</th> <th>จัดการ</th> <th>ลบ</th> </tr> </thead> <tbody> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td> จาเอาภาพมาไว้ตรงนี้อ่าครับ โดยเอามาเรียงเเบบเปนไอดีเรื่อยๆ </td> <td data-title="ลำดับที่" value=""><a href="detail.php?QuestionID=<?=$objResult["QuestionID"];?> "><?=$objResult["QuestionID"];?></td> <td data-title="ชื่อ" value=""><a href="detail.php?QuestionID=<?=$objResult["QuestionID"];?>"><?=$objResult["Question"];?></a></td> <td data-title="โดย" value=""><?=$objResult["Name"];?></td> <td data-title="เมื่อ" value=""><?=$objResult["CreateDate"];?></td> <td data-title="ดู" value=""><a href="detail.php?QuestionID=<?=$objResult["QuestionID"];?> "><?=$objResult["View"];?></td> <td data-title="จัดการ" align="center"><a href="edit.php?QuestionID=<?php echo $objResult["QuestionID"];?>">Edit</a></td> <td data-title="ลบ" align="center"><a href="delete.php?QuestionID=<?=$objResult["QuestionID"];?>">ลบ</a> </tr> </tbody> <? } ?> </table>
<html> <head> <title>ThaiCreate.Com</title> </head> <body> <a href="NewQuestion.php">New Topic</a> ของบอร์ด <? include("../20042560skdesuautodetectpassword.config.inc.php"); $strSQL = "SELECT * FROM webboard"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 10; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> อินครุดของภาพ <? include("../20042560skdesuautodetectpassword.config.inc.php"); $strSQL = "SELECT * FROM img"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="909" border="1"> <tr> <th width="99"> <div align="center">QuestionID</div></th> <th width="458"> <div align="center">Question</div></th> <th width="90"> <div align="center">Name</div></th> <th width="130"> <div align="center">CreateDate</div></th> <th width="45"> <div align="center">View</div></th> <th width="47"> <div align="center">Reply</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> ภาพ <img src="img/<?=$objResult["Imgname"];?>"> <td><div align="center"><?=$objResult["QuestionID"];?></div></td> <td><a href="ViewWebboard.php?QuestionID=<?=$objResult["QuestionID"];?>"><?=$objResult["Question"];?></a></td> <td><?=$objResult["Name"];?></td> <td><div align="center"><?=$objResult["CreateDate"];?></div></td> <td align="right"><?=$objResult["View"];?></td> <td align="right"><?=$objResult["Reply"];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง