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 > วานช่วยดูโค๊ตให้ด้วยครับอยากให้โชว์วันที่ ของ table survey ครับผมทำได้หมดและแต่ไม่รู้จะทำงัยต่อ ลองผิดลองถูกหลายรอบแล้วครับ วานด้วยนะครับ



 

วานช่วยดูโค๊ตให้ด้วยครับอยากให้โชว์วันที่ ของ table survey ครับผมทำได้หมดและแต่ไม่รู้จะทำงัยต่อ ลองผิดลองถูกหลายรอบแล้วครับ วานด้วยนะครับ

 



Topic : 050568



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



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






วานช่วยดูโค๊ตให้ด้วยครับอยากให้โชว์วันที่ ของ table survey ครับผมทำได้หมดและแต่ไม่รู้จะทำงัยต่อ ลองผิดลองถูกหลายรอบแล้วครับ วานด้วยนะครับ

<?
ob_start();
session_start();
if($_SESSION["Login"]=="")
{
header('location:index.php');
exit();
}
require_once('../config/config.php');
?>
<?

function countS($myid) {
$sql = "SELECT count(USER_ID) FROM survey where USER_ID='".$myid."' ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
if ($row[0] >0){
$a ="OK";
}else{
$a = "-";
}
return $a;
}
?>
<?
}
?>


<html>
<head>
<title>:: Answer Checked ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<br>
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" class="FontThai" bordercolor="#996600">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <?php require_once('head.php'); ?> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <div align="center"><br>
<div align="center">
<table cellspacing=1 cellpadding=4 width="75%" bgcolor=#FFFFFF border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="22%" bgcolor="#FFFFFF"> <div align="left"><b>
<img src="../images/dot.gif" width="21" height="21" align="absmiddle">
Answer Checked</b></div></td>
<td width="78%" bgcolor="#FFFFFF"> <div align="right">
</div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</div>
<table id=table4 cellspacing=0
cellPadding=0 width="74%">
<tbody>
<tr>
<td align=left width="50%">
<?
$sql = "select * From user where USER_ID ";
$result = mysql_query($sql);
$Num_Rows = mysql_num_rows($result);
?>
</td>
<td align=right width="50%">Total <strong>
<?=$Num_Rows;?>
</strong> Record(s) Found.</td>
</tr>
</tbody>
</table>
<table cellspacing=1 cellpadding=3 width="74%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5> <td width="8%" bgcolor="#FFFFFF"><div align="center"><strong>ID</strong></div></td>
<td width="22%" bgcolor="#FFFFFF"><div align="center"><strong> Date
answer</strong></div></td>
<td width="31%" bgcolor="#FFFFFF"><div align="center"><strong>Name</strong></div></td>
<td width="39%" bgcolor="#FFFFFF"><div align="center"><strong>Status</strong></div></td>
</tr>
<?
$Per_Page = 25; // จำนวนหน้าที่จะแสดงผลในแต่ละหน้า
if(!$_GET[Page]){$Page=1;}else{$Page=($_GET[Page]);}

$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;

if(($Page>$Num_Pages) || ($Page<0))
{
header("location:?Page=".($_GET[Page]-1)."&USER_ID=".$_GET[userid]."");
print "<center><b>No Data<b></center>";
}
$sql .="order by user.USER_ID LIMIT $Page_start , $Per_Page";

$result = mysql_query($sql);
$NRecord=0;
While($row= mysql_fetch_array($result)){
?>
<tr bgcolor=#e5e5e5>
<td bgcolor="#FFFFFF"> <div align="center">
<?=($row["USER_ID"]);?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=ConvertToDateThaiFromDBTime($row["DATE"]);?>
</div></td>

<td align="center" bgcolor="#FFFFFF">
<?=($row["NAME"]);?>
</td>


<td bgcolor="#FFFFFF"> <div align="center"> <font color="#0000FF">
<?
echo countS($row["USER_ID"])
?>
</font></div></td>
</tr>
<?
}
?>
</tbody>
</table>
<table width="74%" border="0" cellpadding="0" cellspacing="0" class="textnormal">
<tr>
<td height="29" valign="baseline"><span>&nbsp;&nbsp;&nbsp;<strong>Found</strong></span><strong><span>
:</span></strong><strong><span> <b>
<?= $Num_Rows;?>
</b> </span></strong>Total<b>
<?=$Num_Pages;?>
</b> Page :-
<?/* สร้างปุ่มย้อนกลับ */
if($Prev_Page)
echo " <font color='#00FF00'><a href='?USER_ID=$_GET[userid]&Page=$Prev_Page' alt='Back' title='Back'> <font color=#FF0000><- Back</a>";
for($i=1; $i<$Num_Pages+1; $i++){
if($i != $Page)
echo " <a href='?USER_ID=$_GET[userid]&Page=$i' alt='Go to page $i' title='Go to page $i'><font color=#000000>$i</a>";
else
echo "<b><font color=#FF0000> $i </b>";
}


/*สร้างปุ่มเดินหน้า */
if($Page!=$Num_Pages)
echo " <a href ='?USER_ID=$_GET[userid]&Page=$Next_Page' alt='Next' title='Next'><font color=#FF0000> Next -> </a>";

?>
</tr>
</table>
<br>
<br>
</div></td>
</tr>
</table>
</body>
</html>



Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-10-21 16:37:59 By : kapookman007 View : 567 Reply : 5
 

 

No. 1



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



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


ช่วยจับใน php code ให้หน่อย จะดีมากเลยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-10-21 16:45:52 By : kanchen
 


 

No. 2



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



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


Code (PHP)
<?
ob_start();
session_start();
if($_SESSION["Login"]=="")
{
header('location:index.php');
exit();
}
require_once('../config/config.php'); 
					?>
	<?

function countS($myid) {
$sql = "SELECT count(USER_ID) FROM survey where USER_ID='".$myid."' ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
if ($row[0] >0){
$a ="OK";
}else{
$a = "-";
}
return $a;
}
?>
			<?
			}
			?>	
				
								
<html>
<head>
<title>:: Answer Checked ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<br>
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" class="FontThai" bordercolor="#996600">
  <tr> 
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> <?php require_once('head.php'); ?> </td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> <div align="center"><br>
        <div align="center"> 
          <table cellspacing=1 cellpadding=4 width="75%" bgcolor=#FFFFFF border=0 align="center" height="10">
            <tbody>
              <tr bgcolor=#e5e5e5> 
                <td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
                  <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
                    <tbody>
                      <tr bgcolor=#e5e5e5> 
                        <td width="22%" bgcolor="#FFFFFF"> <div align="left"><b> 
                            <img src="../images/dot.gif" width="21" height="21" align="absmiddle"> 
                            Answer Checked</b></div></td>
                        <td width="78%" bgcolor="#FFFFFF"> <div align="right"> 
                          </div></td>
						                      </tr>
                    </tbody>
                  </table></td>
              </tr>
            </tbody>
          </table>
        </div>
        <table  id=table4 cellspacing=0 
                        cellPadding=0 width="74%">
          <tbody>
            <tr> 
              <td align=left width="50%"> 
   <?
$sql = "select * From user  where USER_ID ";
$result  = mysql_query($sql);
$Num_Rows =	mysql_num_rows($result);
?>
              </td>
              <td align=right width="50%">Total <strong> 
                <?=$Num_Rows;?>
                </strong> Record(s) Found.</td>
            </tr>
          </tbody>
        </table>
        <table cellspacing=1 cellpadding=3 width="74%" bgcolor=#CCCCCC border=0 align="center" height="10">
          <tbody>
            <tr bgcolor=#e5e5e5>               <td width="8%" bgcolor="#FFFFFF"><div align="center"><strong>ID</strong></div></td>
              <td width="22%" bgcolor="#FFFFFF"><div align="center"><strong> Date 
                  answer</strong></div></td>
              <td width="31%" bgcolor="#FFFFFF"><div align="center"><strong>Name</strong></div></td>
              <td width="39%" bgcolor="#FFFFFF"><div align="center"><strong>Status</strong></div></td>
            </tr>
            <?		
$Per_Page = 25;   // จำนวนหน้าที่จะแสดงผลในแต่ละหน้า
if(!$_GET[Page]){$Page=1;}else{$Page=($_GET[Page]);}

$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;
	
	if(($Page>$Num_Pages)	|| ($Page<0))
{
header("location:?Page=".($_GET[Page]-1)."&USER_ID=".$_GET[userid]."");
		print "<center><b>No Data<b></center>";
}		
$sql .="order  by user.USER_ID  LIMIT $Page_start , $Per_Page";

$result =  mysql_query($sql);
$NRecord=0;	
While($row= mysql_fetch_array($result)){
?>
            <tr bgcolor=#e5e5e5> 
              <td  bgcolor="#FFFFFF"> <div align="center">
                  <?=($row["USER_ID"]);?>
                </div></td>
              <td  bgcolor="#FFFFFF"> <div align="center"> 
                  <?=ConvertToDateThaiFromDBTime($row["DATE"]);?>
                </div></td>
			
              <td align="center"  bgcolor="#FFFFFF"> 
                <?=($row["NAME"]);?>
              </td>
			  
			  
              <td  bgcolor="#FFFFFF"> <div align="center"> <font color="#0000FF"> 
                  <?
echo countS($row["USER_ID"])
?>
                  </font></div></td>
            </tr>
            <?
	                         	}
	                      	?>
          </tbody>
        </table>
        <table width="74%" border="0" cellpadding="0" cellspacing="0" class="textnormal">
          <tr> 
            <td height="29" valign="baseline"><span>&nbsp;&nbsp;&nbsp;<strong>Found</strong></span><strong><span> 
              :</span></strong><strong><span> <b> 
              <?= $Num_Rows;?>
              </b> </span></strong>Total<b> 
              <?=$Num_Pages;?>
              </b> Page :- 
              <?/* สร้างปุ่มย้อนกลับ */
			if($Prev_Page)	
					echo " <font color='#00FF00'><a href='?USER_ID=$_GET[userid]&Page=$Prev_Page' alt='Back' title='Back'> <font color=#FF0000><- Back</a>";
			for($i=1; $i<$Num_Pages+1; $i++){
						if($i != $Page)
								echo " <a href='?USER_ID=$_GET[userid]&Page=$i' alt='Go to page $i' title='Go to page $i'><font color=#000000>$i</a>";
						else 
							echo "<b><font color=#FF0000> $i </b>";
		}
			
		
/*สร้างปุ่มเดินหน้า */
if($Page!=$Num_Pages)
					echo " <a href ='?USER_ID=$_GET[userid]&Page=$Next_Page' alt='Next' title='Next'><font color=#FF0000> Next -> </a>";
			
			?>
          </tr>
        </table>
        <br>
        <br>
      </div></td>
  </tr>
</table>
</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-10-21 16:54:04 By : kapookman007
 

 

No. 3



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



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


หรือจะเป็น function อีกอันนึงก็ได้นะครับ แต่ขอให้โชว์วันที่จาก table survey filed DATE ครับ ขอบคุณทุกท่านล่วงหน้าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-10-21 17:57:52 By : kapookman007
 


 

No. 4



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



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


เอาเป็นเงื่อนไข if ตรง ช่องวันที่ก็ได้ครับ ขอความรู้สักนิดนะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-10-22 14:48:03 By : kapookman007
 


 

No. 5



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



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


ผมยอมแพ้ไปและครับ เปลี่ยนแนว อิอิ แต่ถ้าใครอยากตอบก็ไม่ว่านะครับ ไว้เป็นความรู้นะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-10-22 15:10:13 By : kapookman007
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : วานช่วยดูโค๊ตให้ด้วยครับอยากให้โชว์วันที่ ของ table survey ครับผมทำได้หมดและแต่ไม่รู้จะทำงัยต่อ ลองผิดลองถูกหลายรอบแล้วครับ วานด้วยนะครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 02
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 อัตราราคา คลิกที่นี่