<div id="container"> <? if($_SESSION['username']){?> <strong><p>เขียนข่าวสารใหม่</p></strong><br /> <form action="index.php" method="post"> <table> <tr> <td>หัวข้อ:</td> <td><input type="text" name="txtnewstitle" style="width:450px;"/></td> </tr> <tr> <td>รายละเอียด:</td> <td><textarea name="txtdetail" cols="45" rows="5" id="txtdetail"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" value="โพสข่าว" /></td> </tr> </table> </form> <? } ?> </div>
<? if($_POST['txtnewstitle']){ $title=$_POST['txtnewstitle']; $detail=$_POST['txtdetail']; echo $title.$detail; include ("../include/connect.php"); $sql = "insert into news(title,detail) values('$title','$detail')"; $sqlQuery = mysql_query($sql) or die ("Cannot Query"); mysql_close(); echo ("โพสเรียบร้อย"); } ?>
$sqlQuery = mysql_query($sql) or die ("Cannot Query");
$sqlQuery = mysql_query($sql) or die (mysql_error());
<strong><p align="center">ข่าวสารใหม่</p></strong><br /> <? include ("include/connect.php"); $strSQL = "SELECT * FROM news"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="200" border="1"> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <? $link=$objResult["news_id"]; ?> <td><div align="center"><a href="viewnews.php?id=<?=$link?>"><?=$objResult["title"];?></a></div></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?>
<? $id=$_GET['id']; echo $id; include ("include/connect.php"); $sql="SELECT news_id,title,detail FROM news WHERE news_id='$id'"; $sqlQuery= mysql_query($sql) or die (mysql_error()); $num=mysql_num_rows($sqlQuery); if($num==0){ echo ("ไม่พบข่าว"); }else{?> <? $data=mysql_fetch_array($sqlQuery); $title=$data["title"]; $detail=$data["detail"]; ?> <table align="center"> <tr> <th><? $title ?></th> </tr> <tr> <td><? $detail?></td> </tr> </table> <? mysql_close(); } ?>
<? $id=$_GET['id']; echo $id; include ("include/connect.php"); $sql="SELECT news_id,title,detail FROM news WHERE news_id='$id'"; $sqlQuery= mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($sqlQuery); if($num==0){ echo ("ไม่พบข่าว"); }else{?> <? $data=mysql_fetch_array($sqlQuery); $title=$data["title"]; $detail=$data["detail"]; ?> <table align="center"> <tr> <th><? echo $title; ?></th> </tr> <tr> <td><? echo $detail;?></td> </tr> </table> <? mysql_close(); } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง