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 > ต้องการทำให้ข้อมูลที่ select มาทั้งหมด แสดงอยู่ใน row เดียวของ table ค่ะ



 

ต้องการทำให้ข้อมูลที่ select มาทั้งหมด แสดงอยู่ใน row เดียวของ table ค่ะ

 



Topic : 058989



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



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




คือว่าได้ทำ select ข้อมูลจาก BD เป็นข้อมูลของ 1 สัปดาห์ มี 7 แถว แต่ report ที่ต้องการ ให้แสดงข้อมูลว่าสัปดาห์นี้เป็นสัปดาห์วันที่เท่าไหร่ถึงเท่าไหร่ และแจงข้างหลังว่า แต่ละวันมีการเข้าออกงานกี่โมงค่ะ (แสดงตาราง 1 สัปดาห์ = 1 แถวค่ะ 1 เดือนต้องไม่เกิน 5 แถว)

รูปตารางสีฟ้า เป็นตารางที่ต้องการ

รูปตารางสีชมพูเป็นตารางที่ได้ตอนนี้

pic

รบกวนทุกท่านให้คำแนะนำด้วยค่ะ



Tag : PHP, MySQL









ประวัติการแก้ไข
2011-04-21 15:02:42
2011-04-21 15:03:45
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-04-21 14:59:24 By : sarinya_yaya View : 2041 Reply : 4
 

 

No. 1



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



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


ออกแบบตารางไว้ยังไงครับ ขอดูหน่อย






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-04-21 15:03:10 By : avsqlz
 


 

No. 2



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



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


ขอดูส่วนของ coding ที่ทำการแสดงผลตารางสีชมพูหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-04-21 15:07:45 By : Pangpondpuen
 

 

No. 3



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



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


นี่เป็น ข้อมูลบางส่วนของ database เป็นข้อมูลของ 00001 1 เดือน ค่ะ

รบกวนด้วยนะค่ะ

123


ประวัติการแก้ไข
2011-04-21 15:11:34
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-04-21 15:10:13 By : sarinya_yaya
 


 

No. 4



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



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


เป็นโค้ดแค่เฉพาะส่วนตารางสีชมพูนะคะ ขอบคุณนะคะ

Code (PHP)
include("config.inc.php");	
$sql = "SELECT  * FROM schedule_shift WHERE Shop_ID = '$shop_i' and Mouth_load = '$mon_id' and Agent_ID = '01032693'  order by Date";
$result = mysql_db_query($dbname , $sql);
$num = mysql_num_rows($result);
if(($mon_id<>"")||($shop_i<>"")){
if($num <>"0"){
 ?>
</p>
<table width="786" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#D8007D">
  <tr bgcolor="#FF85CC">
    <td width="68" rowspan="2" align="center"><span class="style58 style57 style21"><strong>Employee ID </strong></span></td>
    <td width="37" rowspan="2" align="center"><span class="style57 style58 style21"><strong>Code</strong></span></td>
    <td width="71" rowspan="2" align="center"><span class="style57 style58 style21"><strong>Start Date </strong></span></td>
    <td width="68" rowspan="2" align="center"><span class="style58 style57 style21"><strong>End Date</strong></span></td>
    <td height="22" colspan="2" align="center"><span class="style57 style58 style21"><strong>Sun</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Mon</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Tue</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Wed</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Thu</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Fri</strong></span></td>
    <td colspan="2" align="center"><span class="style57 style58 style21"><strong>Sat</strong></span></td>
  </tr>
  <tr bgcolor="#FF85CC">
    <td width="36" height="20" align="center"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style57 style58 style21"><strong>In</strong></span></td>
    <td width="36" align="center" valign="middle"><span class="style58 style57 style21"><strong>Out</strong></span></td>
  </tr>
  <? 
		while ($row = mysql_fetch_array($result)){

			$Agent_ID = $row[Agent_ID];
			$Date_Absence1 = $row[Date_Absence1];
			$Date_Absence2 = $row[Date_Absence2];
			$Detail = $row[Detail];
			$Date_Action = $row[Date_Action];
			$Status = $row[Status];
			$Approve_by = $row[Approve_by];
			$Date_approve  = $row[Date_approve];

			$Time_start  = $row[Time_start];
			$Time_end  = $row[Time_end];
			$Date  = $row[Date];
			$Date_sub = substr($Date,-2);

			$Day1 = $row[Day];
						
			$F99 = "-";
			//}
			?>
  <tr>
    <td  height="24"><div align="center"><? echo $Agent_ID;?></div></td>
    <td><div align="center">6</div></td>
    <td><div align="center"><? if(($Day1 == "Sun")||($Date_sub=="1")){echo $Date;}else{echo $Day1;} ?></div></td>
    <td><div align="center"><? if(($Day1 == "Sat")||($Date_sub==$date_ja)){echo $Date;}else{echo $Day1;} ?></div></td>
    <td><div align="center"><? if($Day1=="Sun"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Sun"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"> <? if($Day1=="Mon"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Mon"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Tue"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Tue"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Wed"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Wed"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Thu"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Thu"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Fri"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Fri"){echo $Time_end;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Sat"){echo $Time_start;}else{echo $F99;}?></div></td>
    <td><div align="center"><? if($Day1=="Sat"){echo $Time_end;}else{echo $F99;}?></div></td>
  </tr>
  <? } ?>
</table>
<p>
  <?
	}else{
	echo "<table width=\"700\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">";
	echo "<tr>";
	echo "<td align=\"center\" valign=\"middle\"><span class = \"denies\">ยังไม่มีการจัดตารางการทำงานในเดือนนี้</span></td>";
	echo "</tr>";
	echo "</table>";
	}     
}else{
	echo "<table width=\"700\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">";
	echo "<tr>";
	echo "<td align=\"center\" valign=\"middle\"><span class = \"style23\">กรุณาเลือก shop และ Month ที่ต้องการค่ะ</span></td>";
	echo "</tr>";
	echo "</table>";
}



ประวัติการแก้ไข
2011-04-21 15:21:05
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-04-21 15:15:39 By : sarinya_yaya
 

   

ค้นหาข้อมูล


   
 

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