ด้วยสํานึกในพระมหากรุณาธิคุณสมเด็จพระนางเจ้าสิริกิติ์เป็นล้นพ้นอันหาที่สุดมิได้
ด้วยสํานึกในพระมหากรุณาธิคุณสมเด็จพระนางเจ้าสิริกิติ์เป็นล้นพ้นอันหาที่สุดมิได้


การดึง ข้อมูล จาก DB มาแสดงในตาราง ดึงจากหลายๆตารางมาแสดง

ถาม-ตอบ แนะนำไอเดีย โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา การดึง ข้อมูล จาก DB มาแสดงในตาราง ดึงจากหลายๆตารางมาแสดง

ปัจจุบัน นักพัฒนาสามารถ ใช้ ChatGPT | Gemini | Claude | Perplexity | Deepseek ช่วยในการแก้ไขปัญหาต่างๆ ในการเขียนโปรแกรม หรือหาข้อมูลเพิ่มเติมได้ง่ายและสะดวก แนะนำให้ทุกคนใช้งานเพื่อพัฒนาศักยภาพของตัวเอง

การดึง ข้อมูล จาก DB มาแสดงในตาราง ดึงจากหลายๆตารางมาแสดง
การดึง ข้อมูล จาก DB มาแสดงในตาราง ดึงจากหลายๆตารางมาแสดง จากรูป สมมติผมจะจอยหลายๆตาราง แล้วคำสั่ง จอย ใส่ส่วนไหนบ้างครับ แล้วหลักการยังไงห่ะ  เช่นผมจะจอย คำนำหน้าชื่อ ของผมเก็บในตาราง tbl_prefix -->prefix_id และ prefix_name  จะจอยกับตาราง tbl_hitory_learn -->pk(history_learn_id) อ้างอิง คำนำหน้าด้วย prefix_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=utf-8" />
<title>ตารางการอบรม</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>

<body>
  <div>
    <div>
    <center>
        <h2><b>*** แสดงผลการอบรม***</b></h2></center>
   <table width="784" border="1" align="center" cellpadding="0" cellspacing="0">
     <tr> 
    <th height="27" align="right" valign="bottom" class="dotline">
      
  <table width="338" border="0" align="center">
    <tr>
      <td>ค้นหาจาก :</td>
      <td><select name="zone">
        <option value=" " selected="selected">วัน เดือน ปี</option>
        <option value=" ">ชื่อผู้เข้าอบรม</option>
        <option value=" ">รายการประชุม</option>
        <option value=" ">สถานที่</option>
      </select></td>
      <td><input type="submit" value="Search" /></td>
    </tr>
  </table></th>
     </tr>
     
</table>
   <p>&nbsp;</p>
   <?php
 include "connect.php";
 	$sql = "select * from tbl_hitory_learn order by history_learn_id";
 	$result = mysql_db_query($dbname,$sql);
 	$num_record = mysql_num_rows($result);  //ประกาศตัวแปร ตัวนับจำนวน สมาชิกทั้งหมด
 $record = mysql_fetch_array($result)
   ?>
   <table width="1302" border="1" align="center" cellpadding="0" cellspacing="0" class="font">
		<thead>
			<tr>
            <th width="89" height="30" align="center">ลำดับที่</th>
            <th width="209" align="center">วัน เดือน ปี</th>
            <th width="134" align="center">เวลาอบรม</th>
			<th width="237" align="center">ผู้เข้าประชุม</th>
			<th width="356" align="center">รายการประชุม/อบรม</th>
            <th width="138" align="center">สถานที่</th>
            <th colspan="3" align="center">จัดการข้อมูล</th>
      </thead>
		<tr>
        	<td height="31" align="center"><?php echo $record ["number"];?></td>
			<td align="center">	<?php echo $record ["number"];?></td>
			<td height="26">	<?php echo $record ["number"];?></td>
			<td align="center">	<?php echo $record ["number"];?></td>
            <td align="center"	><?php echo $record ["number"];?></td>
			<td align="center">	<?php echo $record ["number"];?></td>
            <td width="47" align="center">แก้ไข</td>
            <td width="43" align="center">ลบ</td>
           	<td width="49" align="center">&nbsp;</td>
        </tr>
</table>

  </div>
</div>
  </td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">
</td>
  </tr>
</table>

</body>
</html>


Hasanlebaesa02 14-09-2014 07:46:11

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • CAPTCHA Image
    Play CAPTCHA Audio
    Refresh Image


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
ดูเนื้อหานี้เป็นแนวทาง
 
 

การใช้งาน SQL INNER JOIN 


ninenik 14-09-2014






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ