<link href="style.css" rel="stylesheet" type="text/css" /> <?php include "connect.php"; $search = $_POST['search']; $type = $_POST['year']; ?> <!--<a href="showfolder.php?thesis=<?//=$dbarr['code_proj'];?>" >ดาวน์โหลด</a> --> <div id="content_sub"> <h1 style="padding-left:120px;">ผลการค้นหา</h1> <table align="center" class="simply"> <!-- Table header --> <thead> <tr valign="middle"> <th width="75" scope="col">รหัสภาคนิพนธ์</th> <th width="245" scope="col">ชื่อภาคนิพนธ์</th> <th width="60" scope="col">ปีการศึกษา</th> <th width="75" scope="col">ไฟล์ภาคนิพนธ์</th> </tr> </thead> <? if(!empty($search)) { $strSQL = "select * from pre_topic where name_thi LIKE '%{$_POST['search']}%' and status='6' and year LIKE '%{$_POST['year']}%' or name_eng LIKE '%{$_POST['search']}%' and status='6' and year LIKE '%{$_POST['year']}%' and status='6'"; $objQuery = mysql_query($strSQL); if($objQuery) { $Num_Rows = mysql_num_rows($objQuery) ; // ตรวจสอบจำนวนแถวที่ค้นหา $Per_Page = 7; // 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 id ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); if($Num_Rows==0) { ?> <tbody> <tr> <td colspan="4" align="center"><strong><? echo "$search ไม่มีในฐานข้อมูล" ; ?></strong> <p> </p> <p> </p></td> </tr> </tbody> <? } else { while($dbarr = mysql_fetch_array($objQuery)) { $sql_teacher = "select * from teacher where teacher_email='".$_SESSION['username']."' "; $dbquery_teacher = mysql_query($sql_teacher); $result_teacher= mysql_fetch_array($dbquery_teacher); $sql_student = "select * from student where student_id='".$_SESSION['username']."' "; $dbquery_student = mysql_query($sql_student); $result_student= mysql_fetch_array($dbquery_student); $sql_user = "select * from user where username='".$_SESSION['username']."' "; $dbquery_user = mysql_query($sql_user); $result_user= mysql_fetch_array($dbquery_user); ?> <!-- Table body --> <tbody> <tr> <td><center><? echo"".$dbarr['code_proj'].""; ?></center></td> <td><? echo"".$dbarr['name_thi']."";?><? echo"<br>".$dbarr['name_eng'].""; ?></td> <td><? echo"".$dbarr['year'].""; ?></td> <td> <? if($result_teacher){?> <a href="showfolder1.php?thesis=<?=$dbarr['code_proj'];?>" ><center><img src="images/ic_down.gif" /></center></a> <? } if($result_student){?> <a href="showfolder2.php?thesis=<?=$dbarr['code_proj'];?>" ><center><img src="images/ic_down.gif" /></center></a> <? } if($result_user){?> <a href="showfolder3.php?thesis=<?=$dbarr['code_proj'];?>" ><center><img src="images/ic_down.gif" /></center></a> <? } ?></td> </tr> </tbody> <? } // จบ while } // จบ Else } // จบ if($result) }else if(trim($_POST['search'])==""){ $strSQL = "SELECT * FROM pre_topic where year='".$year."' and status = '6' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows=mysql_num_rows($objQuery); //while($arr = mysql_num_rows($obResult)) { $Per_Page = 7; // 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 id ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); while($arr = mysql_fetch_array($objQuery)){ ?> <tbody> <tr> <td><center><? echo"".$arr['code_proj'].""; ?></center></td> <td><? echo"".$arr['name_thi']."";?><? echo"<br>".$arr['name_eng'].""; ?></td> <td><? echo"".$arr['year'].""; ?></td> <td><? if($_SESSION['username'] == ""){?> <a href="index.php?page=download"<?=$arr['code_proj'];?> ><center><img src="images/ic_down.gif" /></center></a> <? }if($result_teacher){?> <a href="showfolder1.php?thesis=<?=$arr['code_proj'];?>" ><center><img src="images/ic_down.gif" /></center></a> <? } if($result_student){?> <a href="showfolder2.php?thesis=<?=$arr['code_proj'];?>" ><center><img src="images/ic_down.gif" /></center></a> <? } if($result_user){?> <a href="showfolder3.php?thesis=<?=$arr['code_proj'];?>"><center><img src="images/ic_down.gif" /></center></a> <? } ?></td> </tr> </tbody> <? } }else{ echo "ค้นหาเฉพาะที่ต้องหา"; }?> <!-- Table footer--> <tfoot> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </tfoot> </table> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ย้อนกลับ</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'>ถัดไป>></a> "; } ?> </div><!--content_sub-->
$strSQL .=" order by id ASC LIMIT $Page_Start , $Per_Page"; echo $sgrSQL;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง