<div id="newsfeed_contain"> <?php //run number page $strSQLa = "SELECT * FROM topic"; $resulta = mysql_query($strSQLa)or die(mysql_error().$strSQaL); $runnumber = 0; while ($rowa=mysql_fetch_array($resulta)){ //echo $row['topic_name']; $idMembera = $rowa['member_id']; //echo $member_id."AAA<br>"; //echo $idMember."ddd<br>"; $strSQL2a = "SELECT * FROM friend WHERE friend_1 = '$member_id' AND friend_2 = '$idMembera' "; $result2a = mysql_query($strSQL2a)or die(mysql_error().$strSQL2a); $row2a=mysql_fetch_array($result2a); $friend2a = $row2a['friend_2']; if($friend2a != '' or $member_id == $idMembera){ $runnumber = $runnumber + 1; } } //run number page $strSQL = "SELECT * FROM topic"; $result = mysql_query($strSQL)or die(mysql_error().$strSQL); $Num_Rows = $runnumber; $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 topic_id DESC "; $objQuery = mysql_query($strSQL); //echo $Page; $a = ($Page * $Per_Page) - 9; $b = $Page * $Per_Page; $c = 0; //echo $a; //echo " and "; //echo $b; while ($row=mysql_fetch_array($objQuery)){ //while ($row=mysql_fetch_array($objQuery)){ //echo $row['topic_name']; //echo $row=mysql_fetch_array($objQuery); $idMember = $row['member_id']; //echo $member_id."AAA<br>"; //echo $idMember."ddd<br>"; $strSQL2 = "SELECT * FROM friend WHERE friend_1 = '$member_id' AND friend_2 = '$idMember' "; $result2 = mysql_query($strSQL2)or die(mysql_error().$strSQL2); $row2=mysql_fetch_array($result2); $friend2 = $row2['friend_2']; if($friend2 != '' or $member_id == $idMember){ //$strSQL2 .=" order by friend DESC LIMIT $Page_Start , $Per_Page"; //while ($row10=mysql_fetch_array($objQuery)){ //echo $row2['friend_2']; $strSQLmember = "SELECT * FROM member WHERE member_id = '$idMember'"; $resultmember = mysql_query($strSQLmember)or die(mysql_error().$strSQLmember); $rowmember=mysql_fetch_array($resultmember); $c = $c + 1; if($b >= $a && $c >= $a){ //echo $a; //echo $member_name; //echo $idMember; //echo $rowfriend['friend_2']; //if(mysql_query($rowmember)){ ?> <div class="newsfeed"> <div class="pic_newsfeed"> <?php if($rowmember['member_pic'] == ''){?> <img src="images/bgprofile1.jpg" width="50" height="50" /> <?php }else{?> <img src="myfile/<?php echo $rowmember["member_pic"];?>" width="50" height="50" /> <?php } ?> </div> <div class="text_newsfeed"> <span><?php echo $rowmember['member_name']?></span> <span><?php echo $row['topic_date']; ?></span> </div> <div class="text_newsfeed2"> <!--<a href="news_feed_comment.php?topic_id=<?php echo $row["topic_id"];?>" class="new-webbroad">--> <?php echo $row['topic_name']; ?> </a> <span style="float:right"><input type="button" name="button" id="button" value="อ่านรายละเอียดโพสต์" onclick="window.location='news_feed_comment.php?topic_id=<?php echo $row["topic_id"];?>'" / class="btn btn-default"> </span> </div> </div> <?php $a = $a+1; } } //$topic_date = $row['topic_date']."<br>"; //echo $row['topic_detail']; } ?> <br> ทั้งหมด <?= $Num_Rows;?> กระทู้ หน้า : <? /*=$Num_Pages;*/ ?><? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ก่อนหน้า</a> "; } for($i=1; $i<=$Num_Pages; $i++){ $Page1 = $Page-2; $Page2 = $Page+2; if($i != $Page && $i >= $Page1 && $i <= $Page2) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } elseif($i==$Page) { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป >></a> "; } ?> </div>
WHERE member_id IN (SELECT member_id FROM table_name WHERE ....)
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง