<?php session_start(); echo "Load Time : ".date("Y-m-d H:i:s"); $strSearch = $_POST["mySearch"]; $strPage = $_POST['myPage']; include("config.inc.php"); mysql_query("set NAMES'UTF8'"); $sql = "SELECT * FROM member where username='$_SESSION[programmer]'"; $result = mysql_query($sql) or die ("Error Query [".$sql."]"); $arr = mysql_fetch_array($result); $strSQL = "SELECT * FROM fservice WHERE admin = '$arr[adminname]' and fid LIKE '%".$strSearch."%'and status2='No' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $rows = mysql_num_rows($objQuery); $sqlCount = "SELECT count( 'read' ) FROM fservice WHERE admin = '$arr[adminname]' AND readStat = 0"; $result2 = mysql_query($sqlCount); $row = mysql_fetch_row($result2); $Per_Page = 15; $Page = $strPage; if(!$strPage) { $Page = 1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($rows<=$Per_Page) { $Num_Page =1; } else if(($rows%$Per_Page)==0) { $Num_Page = ($rows/$Per_Page); } else { $Num_Page = ($rows/$Per_Page)+1; $Num_Page = (int)$Num_Page; } $strSQL .="order by fdate DESC LIMIT $Page_Start, $Per_Page"; $objQuery = mysql_query($strSQL); if ($rows <=0){ echo "<table width=800 align=center>"; echo "<font color=#FF0000><strong>ไม่พบรายงานที่ค้นหา</strong></font>"; echo "</table>"; } else{ ?> <style type="text/css"> <!-- a:link { color: #0000FF; } a:visited { color: #0000FF; } a:hover { color: #FFFFFF; } a:active { color: #FFFFFF; } .style 22{ font-size: 5px; } .style4 {color: #FFFFFF} --> </style> <?php echo "จำนวนทั้งหมด $row[0] "; if($row[0] != 0){ echo "<font color=FF0000><b>คุณมีรายงานใหม่</b></font>"; } ?> </script> <table width="850" border="0" align="center"> <tr> <th width="164" bgcolor="#009E8E" scope="col"><span class="style22 style4">รหัสรายงาน</span></th> <th width="177" bgcolor="#009E8E" scope="col"><span class="style22 style4">ผู้ประสานงาน</span></th> <th width="138" bgcolor="#009E8E" scope="col"><span class="style22 style4">หน่วยงาน</span></th> <th width="173" bgcolor="#009E8E" scope="col"><span class="style22 style4">เบอร์โทรศัพท์</span></th> <th width="100" bgcolor="#009E8E" scope="col"><span class="style22 style4">สถานะงาน</span></th> </tr> <? while($arr = mysql_fetch_array($objQuery)) { $i=$i+1; ?> <tr> <td><div align="center"><?php if($arr['readStat'] == 0){ echo "<img src=\"images/new.gif\" width=\"25\" height=\"9\" title=\"รายงานใหม่\">"; } ?><a href="read_update.php?fid=<?=$arr['fid'];?>&pagename=<?=$arr['serviceFile'];?>" target="_blank"> <?=$arr['fid']; ?></a></div></td> <td><?=$arr["fname"];?></td> <td><?=$arr["fdiv"];?></td> <td><?=$arr["ftel"];?></td> <td align="center"><?php if ($arr['status2']=="Yes"){ echo "<img src=\"images/true.png\" width=\"12\" height=\"12\" title=\"เสร็จเรียบร้อย\">"; }else{ echo "<img src=\"images/false.png\" width=\"12\" height=\"12\" title=\"ยังไม่เสร็จ\">"; } ?></td> <td width="18"> <input type="checkbox" name="chkStat<?=$i;?>" value="1"> </td> </tr> <? } } ?> </table> <table width="850" border="0" align="center"> <tr> <td align="right"> <input type="submit" name="submit" value="บันทึก"> <input type="hidden" name="hdnLine" value="<?=$i;?>"> </td> </tr> </table> <br/> <center> Total <?= $rows;?> Record : <?=$Num_Page;?> Page : <? if($Prev_Page) { echo " <a href=\"JavaScript:doCallAjax(document.getElementById('txtSearch').value,'$Prev_Page')\"><< Back</a> "; } for($i=1; $i<=$Num_Page; $i++){ if($i != $Page) { echo "[ <a href=\"JavaScript:doCallAjax(document.getElementById('txtSearch').value,'$i')\">$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Page) { echo " <a href=\"JavaScript:doCallAjax(document.getElementById('txtSearch').value,'$Next_Page')\">Next >></a> "; } ?> </center>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <script language="JavaScript"> function onSave() { if(confirm('Do you want to save ?')==true) { return true; } else { return false; } } </script> <form name="frmMain" action="save.php" method="post" OnSubmit="return onSave();"> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> <th width="30"> <div align="center">Select </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["CustomerID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["CountryCode"];?></div></td> <td align="right"><?=$objResult["Budget"];?></td> <td align="right"><?=$objResult["Used"];?></td> <td align="center"><input type="checkbox" name="chkEmail[]" value="<?=$objResult["Email"];?>"></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> <input type="submit" name="btnSave" value="Save"> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); for($i=0;$i<count($_POST["chkEmail"]);$i++) { if($_POST["chkEmail"][$i] != "") { $strSQL = "INSERT INTO table_name (Mail) VALUES ('".$_POST["chkEmail"][$i]."')"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); } } echo "Record Insert."; mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง