<?php //include ("connect_db.php"); //$_SESSION["member_stdid"]; ?> <? //session_start(); //if($_SESSION['member_stdid'] ==""){ // ถ้า $_SESSION['user'=ค่าว่าง แสดงว่าเขากำลังจะมาลักไก่เรา //?> <script type="text/javascript"> //alert ('สงวนสิทธิ์การใช้งานเฉพาะสมาชิกเท่านั้น \n กรุณาล๊อกอินเข้าสู่ระบบก่อนนะค่ะ \n...ขอบคุณค่ะ'); // เราก็แจ้งเลยว่า หยุด อย่าขยับ เจ้าหน้าที่ล้อมไว้หมดแล้ว //window.location="index.php"; // แล้วก็ส่งเขากลับไปหน้าแรก หรือหน้าสำหรับสมัครสมาชิกเลย </script> <? //} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ระบบกิจกรรมนักศึกษา</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css"> <script type="text/javascript" src="js/bootstrap.min.js/"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <style type="text/css"> body{ background-image: url("image/bag.jpg"); } .aa{ background-color: #D0E2EE; } th{ text-align: center; background-color: #90c3ed; padding: 3px 3px; } .t{ text-align: center; } .d:nth-child(even) {background: #fff} .d:nth-child(odd) {background:#cff3f7} p{ padding-left: 5px; padding-top: 5px; } </style> <body> <table border="0" class="aa" width="80%" cellpadding="0" cellspacing ="0" align="center" valign="top"> <tr> <td colspan="2"> <? include ("head.php");?> </td> </tr> <tr> <td> <? include ("menu2.php");?> </td> <td valign="top" width="95%" > <?php include ("connect_db.php"); ?> <table align="right" width="99%" border="0" align="center" > <tr> <td> <div class="panel panel-primary"> <br><h3 align="center">ผลการลงทะเบียนกิจกรรม</h3> <div class="panel-body"> <form name="frmSearch" method="get" action="<?php echo $_SERVER['SCRIPT_NAME'];?>"> <table width="95%" border="0" align="center" cellpading="0" cellspacing="0" > <tr> <td>ผลการลงทะเบียน : <input name="txtKeyword" type="text" id="txtKeyword" value="<?php echo $_GET["txtKeyword"];?>"> <input type="submit" value="ค้นหา"> </td> </tr> </table> </form> <?php if($_GET["txtKeyword"] != "") // Search By Name or Email $strSQL = "SELECT * FROM regis LEFT JOIN activity ON (regis.act_id = activity.act_id) WHERE (regis.student_id LIKE '%".$_GET["txtKeyword"]."%')"; $objQuery = mysql_query($strSQL) or die ("ยังไม่มีผลลัพธ์การค้นหา[".$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 regis.act_id ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table id="customers" width="600" border="1" align="center" > <tr> <th colspan="5"> ผลการเข้าร่วมกิจกรรม </th> </tr> <tr> <th width="190"> <div>ชื่อกิจกรรม</div></th> <th width="100"> <div align="center">วันที่จัด</div></th> <th width="98"> <div align="center">จำนวนชั่วโมง</div></th> <th width="80"> <div align="center">สถานะ</div></th> </tr> <? $count_hrs = array(); while ($objResult = mysql_fetch_array($objQuery)){ array_push($count_hrs,$objResult["act_hour"]); ?> <?php //echo array_count("$count_hrs"); ?> <tr> <td ><div><?php echo $objResult["act_name"];?></div></td> <td align="center"><?php echo $objResult["act_date"];?></td> <td align="center"><?php echo $objResult["act_hour"];?></td> <td align="center"><?php //echo $objResult["act_date"];?></td> </tr> <? } ?> </table> <br> Total <?php echo $Num_Rows;?> Record : <?php echo $Num_Pages;?> Page : <?php if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> "; } ?> </td> </tr> </table> <tr> <td colspan="2" align="center"> <? include ("footer.php");?> </td> </tr> </table> <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("slow"); }); $("#fli").click(function(){ $("#pane").slideToggle("slow"); }); $("#fl").click(function(){ $("#pan").slideToggle("slow"); }); }); </script> </body> </html>
Quote:$total=0; while ($objResult = mysql_fetch_array($objQuery)){ array_push($count_hrs,$objResult["act_hour"]); ?> <?php //echo array_count("$count_hrs"); ?> <tr> <td ><div><?php echo $objResult["act_name"];?></div></td> <td align="center"><?php echo $objResult["act_date"];?></td> <td align="center"><?php echo $objResult["act_hour"];?></td> <td align="center"><?php //echo $objResult["act_date"];?></td> </tr> <? $total+=$objResult["act_hour"]; } ?> <tr><td colspan='2'>รวมจำนวนชั่วโมง</td><td><?php echo $total;?></td></td> </td></tr> </table>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง