Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยแก้โค้ดให้หน่อยค่ะ อยากได้โค้ดนับเวลาโดยเรียกจากฐานข้อมูลค่ะจะต้องทำไงค่ะ ช่วยที



 

ช่วยแก้โค้ดให้หน่อยค่ะ อยากได้โค้ดนับเวลาโดยเรียกจากฐานข้อมูลค่ะจะต้องทำไงค่ะ ช่วยที

 



Topic : 074708



โพสกระทู้ ( 28 )
บทความ ( 0 )



สถานะออฟไลน์




Code (PHP)
<?php
		$result = array();
		$result[1]['ex_id'] = "1";
		$result[1]['ex_name'] = "Introducing the TCP/IP Model";

		$result[2]['ex_id'] = "2";
		$result[2]['ex_name'] = "Introducing LANs and Their Computer";

		$result[3]['ex_id'] = "3";
		$result[3]['ex_name'] = "Describing Ethernet Interface";

		$result[4]['ex_id'] = "4";
		$result[4]['ex_name'] = "Introducing LANs and Their Computer";

		$result[5]['ex_id'] = "5";
		$result[5]['ex_name'] = "Describing Ethernet Interface";

		$result[6]['ex_id'] = "6";
		$result[6]['ex_name'] = "Introducing LANs and Their Computer";

		$result[7]['ex_id'] = "7";
		$result[7]['ex_name'] = "Describing Ethernet Interface";

		$result[8]['ex_id'] = "8";
		$result[8]['ex_name'] = "Introducing LANs and Their Computer";

		$result[9]['ex_id'] = "9";
		$result[9]['ex_name'] = "Describing Ethernet Interface";

		$result[10]['ex_id'] = "10";
		$result[10]['ex_name'] = "Introducing LANs and Their Computer";

		$result[11]['ex_id'] = "11";
		$result[11]['ex_name'] = "Describing Ethernet Interface";

		$result[12]['ex_id'] = "12";
		$result[12]['ex_name'] = "Introducing LANs and Their Computer";






$exIdReq = array();
if(count($result) > 0){
	foreach($result AS $index => $value){
		$exIdReq[] = $value['ex_id'];
	}
}
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>

<script type='text/javascript' src='js/jquery.min.js'></script>

<script type='text/javascript'>

setTimeout('checkedCondition()',1000);

function checkedCondition(){
	var ex_id_json = <?php echo json_encode($exIdReq); ?>;
	$.getJSON("CheckExcercise.php",{ // http://api.jquery.com/jQuery.getJSON/
		exIdList: ex_id_json // exIdList = parameter, ex_id_json = parameter value (json format)
	 }, function(data) {
		$.each(data, function(){ // http://api.jquery.com/jQuery.each/
			//alert("ID = " + this.id + ", STATUS = "+ this.status + ", FILE PATH = " + this.file_path);
			if(this.status == "Y"){
				$('#excercise_' + this.id + '_th').html('<a href="'+this.file_path+'" target="_blank"><img src="picture/PDF.png" alt="" width="32" height="32" /></a>');
				// http://api.jquery.com/html/
				$('#excercise_' + this.id + '_en').html('<a href="'+this.file_path+'" target="_blank"><img src="picture/PDF.png" alt="" width="32" height="32" /></a>');
				//setTimeout('checkedCondition()',10000);
			}else{
				$('#excercise_' + this.id + '_th').html('');
				$('#excercise_' + this.id + '_en').html('');
			}
		});

		setTimeout('checkedCondition()',30000);
		
	});
	
}
</script>

<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
.style2 {color: #0000FF}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style3 {color: #39590E}
.style4 {font-size: 14px}
-->
</style>
</head>

<body>
<table width="972" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="972"><a href="index.php"><img src="picture/index.jpg" alt="" width="960" height="200" border="0" usemap="#Map" /></a>
      <map name="Map" id="Map2">
        <area shape="rect" coords="77,169,144,197" href="index.php" />
        <area shape="rect" coords="163,169,231,198" href="Lession.php" />
        <area shape="rect" coords="308,166,446,202" href="Excercise.php" />
        <area shape="rect" coords="460,170,661,199" href="ansExcercise.php" />
        <area shape="rect" coords="241,162,299,200" href="slides/index/index.htm" />
      </map>
      <map name="Map" id="Map">
        <area shape="rect" coords="582,273,688,297" href="Excercise.php" />
        <area shape="rect" coords="509,274,570,295" href="Lession1.php" />
        <area shape="rect" coords="381,272,452,300" href="index.php" />
      </map></td>
  </tr>
  <tr>
    <td valign="top"><center> 
      <table width="973" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="208" valign="top" bgcolor="#D6EDC3"><table width="208" border="0" cellpadding="0" cellspacing="0">
            <tr valign="top">
              <td colspan="2" bgcolor="#D6EDC3"><img src="picture/ppp.jpg" width="204" height="40" /></td>
              </tr>
            <tr valign="top" bgcolor="#D6EDC3">
              <td width="18"><img src="picture/aa.jpg" width="18" height="18" /></td>
              <td width="190" align="left"><span style="color: #00C; font-family: sans-serif; font-size: 14px;">&#3605;&#3634;&#3619;&#3634;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;</span></td>
            </tr>
            <tr valign="top" bgcolor="#D6EDC3">
              <td><img src="picture/aa.jpg" alt="" width="18" height="18" /></td>
              <td align="left"><a href="selectgroup.php"><span class="style4">&#3605;&#3619;&#3623;&#3592;&#3626;&#3629;&#3610;&#3619;&#3634;&#3618;&#3594;&#3639;&#3629;-&#3585;&#3621;&#3640;&#3656;</span>&#3617;</a></td>
            </tr>
            <tr valign="top" bgcolor="#D6EDC3">
              <td><img src="picture/aa.jpg" alt="" width="18" height="18" /></td>
              <td align="left"><span class="style4" style="color: #009"><a href="up/Upload1.php">&#3626;&#3656;&#3591;&#3585;&#3634;&#3619;&#3610;&#3657;&#3634;&#3609;</a></span></td>
            </tr>
            <tr valign="top" bgcolor="#D6EDC3">
              <td><img src="picture/aa.jpg" alt="" width="18" height="18" /></td>
              <td align="left"><span class="style4 style3"><a href="index.php">&#3629;&#3629;&#3585;&#3592;&#3634;&#3585;&#3619;&#3632;&#3610;&#3610;</a>
                  <?php //logout.php
                    @session_start();
                    @session_destroy(); //&#3621;&#3657;&#3634;&#3591; session &#3607;&#3640;&#3585;&#3605;&#3633;&#3623;
                    ?>
              </span></td>
            </tr>
            <tr valign="top">
              <td bgcolor="#D6EDC3">&nbsp;</td>
              <td bgcolor="#D6EDC3">&nbsp;</td>
            </tr>
          </table></td>
          <td width="765" valign="top"><table width="755" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="picture/ooo1.jpg" width="755" height="41" /></td>
              </tr>
            <tr>
              <td height="31"><table width="754" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td colspan="4">&nbsp;</td>
                  </tr>
                <tr>
                  <td width="42" height="36" align="center" bgcolor="#CCCCCC">&#3610;&#3607;&#3607;&#3637;&#3656;</td>
                  <td width="556" align="center" bgcolor="#CCCCCC">&#3649;&#3610;&#3610;&#3613;&#3638;&#3585;&#3611;&#3599;&#3636;&#3610;&#3633;&#3605;&#3636;&#3585;&#3634;&#3619;</td>
                  <td width="70" align="center" bgcolor="#CCCCCC">&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;</td>
                  <td width="86" align="center" bgcolor="#CCCCCC">&#3616;&#3634;&#3625;&#3634;&#3629;&#3633;&#3591;&#3585;&#3620;&#3625;</td>
                </tr>

				<?php
				if(count($result) > 0){
					$runingNumber = 1;
					foreach($result AS $index => $value){
						$style = "";
						if($runingNumber%2 == 0){
							$style = 'bgcolor="#FFFF66"';
						}
				?>
				 <tr>
                  <td align="center" <?php echo $style; ?>><?php echo $runingNumber; ?></td>
                  <td align="left" <?php echo $style; ?>><strong><?php echo $value['ex_name']; ?></a></a> </strong> <span class="style1">&nbsp;</span></td>
                  <td align="center" <?php echo $style; ?> id="excercise_<?php echo $value['ex_id']; ?>_th"></td>
                  <td align="center" <?php echo $style; ?> id="excercise_<?php echo $value['ex_id']; ?>_en"></td>
                </tr>
				<?php
						$runingNumber++;
					}
				}
				?>

				<!--
                <tr>
                  <td align="center" bgcolor="#FFFF66">1</td>
                  <td align="left" bgcolor="#FFFF66"><strong>Introducing the TCP/IP Model</a></a> </strong> <span class="style1">&nbsp;</span></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_1_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_1_en"></td>
                </tr>
                <tr>
                  <td align="center">2</td>
                  <td align="left"><strong>Introducing LANs and Their Compute</strong>r</a></a></td>
                  <td align="center" id="excercise_2_th"></td>
                  <td align="center" id="excercise_2_en"></td>
                </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">3</td>
                  <td align="left" bgcolor="#FFFF66"><strong>Describing Ethernet Interface</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_3_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_3_en"></td>
                </tr>
				-->
				<!--
                <tr>
                  <td align="center">4</td>
                 <td align="left" bgcolor="#FFFF66"><strong>Describing ARP and RARP</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_4_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_4_en"></td>
                </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">5</td>
                  <td align="left" bgcolor="#FFFF66"><strong>Configuring IP</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_5_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_5_en"></td>

                </tr>
                <tr>
                  <td align="center">6</td>
				 <td align="left" bgcolor="#FFFF66"><strong>Configuring ultipathing</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_6_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_6_en"></td>
			   </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">7</td>
				  <td align="left" bgcolor="#FFFF66"><strong>Configuring Routing</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_7_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_7_en"></td>
                 
                </tr>
                <tr>
                  <td align="center">8</td>
				 <td align="left" bgcolor="#FFFF66"><strong>IPv6</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_8_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_8_en"></td>
                </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">9</td>
				  <td align="left" bgcolor="#FFFF66"><strong>Describing the Transport Layer</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_9_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_9_en"></td>

                </tr>
                <tr>
                  <td align="center">10</td>
				   <td align="left" bgcolor="#FFFF66"><strong>Configuring DNS</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_10_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_10_en"></td>
                </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">11</td>
				   <td align="left" bgcolor="#FFFF66"><strong>Configuring DHCP</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_11_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_11_en"></td>
                </tr>
                <tr>
                  <td align="center">12</td>
				   <td align="left" bgcolor="#FFFF66"><strong>Configuring NTP</a></a></strong></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_12_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_12_en"></td>
                </tr>
                <tr>
                  <td align="center" bgcolor="#FFFF66">13</td>
                  <td align="left" bgcolor="#FFFF66"><strong>Configuring WWW</strong></td>
                 <td align="center" bgcolor="#FFFF66" id="excercise_13_th"></td>
                  <td align="center" bgcolor="#FFFF66" id="excercise_13_en"></td>
                </tr>
				-->
                <tr>
                  <td valign="top">&nbsp;</td>
                  <td>&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td valign="top">&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table></td>
              </tr>
            <tr>
              <td><img src="picture/ooo1.jpg" width="755" height="41" /></td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td colspan="2"><table width="964" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="461"><img src="picture/fff.jpg" width="461" height="92" /></td>
              <td width="487"><span 
            </tr>
          </table></td>
          </tr>
      </table>
      </center>
    </td>
  </tr>
</table>
</body>
</html>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-02-28 15:24:42 By : rungjanjira View : 902 Reply : 2
 

 

No. 1



โพสกระทู้ ( 28 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
<?php
$sql = "select * from excercise";
$sql_query = mysql_query($sql);
$arry = mysql_feach_array($sql_query);
while($arry = mysql_feach_array($sql_query)){
	$exvalue[$start_time]['start_time'] = $_GET["start_time"];
	$exvalue[$stop_time]['stop_time'] = $_GET["stop_time"];
	$exvalue[$file_path]['file_path'] = $_GET["file_path"];
}
$list = $_REQUEST['exIdList'];
//fake ex value to test (ให้ทำการ query มาจาก db แทน)
/*$exValue[1]['start_time'] = "03:02:00";
$exValue[1]['stop_time'] = "03:05:00";
$exValue[1]['file_path'] = "introduction.pdf";

$exValue[2]['start_time'] = "03:02:00";
$exValue[2]['stop_time'] = "03:05:00";
$exValue[2]['file_path'] = "introduction.pdf";

$exValue[3]['start_time'] = "03:02:00";
$exValue[3]['stop_time'] = "03:05:00";
$exValue[3]['file_path'] = "introduction.pdf";
*/ 
$currentTime = strtotime(date('H:i:s'));
$responseArray = array();
foreach($list AS $index => $value){
	if($currentTime >= strtotime($exValue[$value]['start_time']) && $currentTime <= strtotime($exValue[$value]['stop_time'])){
		$responseArray[$value]['id'] = $value;
		$responseArray[$value]['status'] = "Y";
		$responseArray[$value]['file_path'] = $exValue[$value]['file_path'];
	}else{
		$responseArray[$value]['id'] = $value;
		$responseArray[$value]['status'] = "N";
		$responseArray[$value]['file_path'] = "";
	}
}
echo json_encode($responseArray);
?>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-28 15:25:00 By : rungjanjira
 


 

No. 2



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ให้ดูอะไรครับ code เยอะมาก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-29 17:43:47 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยแก้โค้ดให้หน่อยค่ะ อยากได้โค้ดนับเวลาโดยเรียกจากฐานข้อมูลค่ะจะต้องทำไงค่ะ ช่วยที
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่