<html> <head> <title>ThaiCreate.Com</title> </head> <body> <a href="NewQuestion.php">New Topic</a> <? $objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database"); $objDB = mysql_select_db("network"); $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> <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>
<? $objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database"); $objDB = mysql_select_db("network"); if($_GET["Action"] == "Save") { //*** Insert Question ***// $strSQL = "INSERT INTO webboard "; $strSQL .="(CreateDate,Question,Details,Name) "; $strSQL .="VALUES "; $strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".$_POST["txtDetails"]."','".$_POST["txtName"]."') "; $objQuery = mysql_query($strSQL); header("location:Webboard.php"); } ?> <html> <head> <title>ThaiCreate.Com</title> </head> <body> <form action="NewQuestion.php?Action=Save" method="post" name="frmMain" id="frmMain"> <table width="621" border="1" cellpadding="1" cellspacing="1"> <tr> <td>Question</td> <td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td> </tr> <tr> <td width="78">Details</td> <td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td> </tr> <tr> <td width="78">Name</td> <td width="647"><input name="txtName" type="text" id="txtName" value="" size="50"></td> </tr> </table> <input name="btnSave" type="submit" id="btnSave" value="Submit"> </form> </body> </html> <? mysql_close($objConnect); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง