|  | 
	                
  
    | 
	 
        เราจะนำข้อมูลจากฐานข้อมูลมาโชว์ยังไงค่....รบกวนเซียน php ตอบด่วนค่ะ.....ขอบคุณค่ะ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | คือปัญหามีอยู่ว่า....... 
 ดิฉันทำบทเรียนโดยในบทเรียนสามารถเพิ่ม-ลบ-แก้ไขบทเรียนได้ค่ะ
 
 แต่พอทำเสร็จแล้วดิฉันจะต้องนำข้อมูลในบทเรียนนั้นมาให้นักศึกษาเรียนในชั้นเรียนออนไลน์แต่ว่าดิฉันไม่รู้ว่าเวลาจะดึงเอาข้อมูลของแต่ละบทมานั้นต้องดึงอย่างไรและต้องสร้างฟอร์มแบบไหน
 
 การที่จะให้เข้าไปเรียนทีละบทนั้น ก็ต้องมีหน้าหลักของนักศึกษาและในหน้าหลักก็ต้องมีบทเรียนแต่ละบทซึ่งดิฉันจะดึงเอาจากฐานข้อมูลที่ทำไว้นั้น ต้องทำอย่างไรค่ะ
 
 รบกวนเซ๊ยนทั้งหลายช่วยแนะนำด่วนค่ะต้องใช้ด่วนค่ะ
 
 ขอบคุณมากค่ะ
 
 
 lessons.php...........อันนี้หน้าที่จะเข้าไปเพิ่มลบแก้ไข
 
 <? session_start(); ?>
 <html>
 <head>
 <title></title>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-874">
 </head>
 <?
 include("connect.php");
 if(!session_is_registered("login_true")) {
 //  url=index.php คำสั่งนี้จะให้ไปหน้าที่จะต้องกรอก user,pwd ถ้าอยู่โฟล์เดอร์อื่นให้เรียกให้ถูก
 echo"<br><br><br><br><br><br><center><img src='image/backlogin.gif'></center>";
 echo "<meta http-equiv='refresh' content='5;url=index.php'>" ;
 exit() ;
 }
 
 ?>
 <style>
 a			{font-size:12;color:#0000cc;}
 a:link		{color:#0000cc;text-decoration:none;}
 a:hover	{color:red;text-decoration:bold;}
 a:visited	{color:none;text-decoration:'none'}
 </style>
 
 <body>
 <table width="97%"  border="0" align="center" cellspacing="1" bgcolor="#666666">
 <tr>
 <td height="404"  valign="top" bgcolor="#FFFFFF">
 <div align="center"></div>
 <div align="center">
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
 <!--DWLayoutTable-->
 <tr bgcolor="#FFFFFF">
 <td width="766" >
 <?php  include'home.php'; ?>
 </td>
 </tr>
 <tr valign="top" bgcolor="#FFFFFF">
 <td ><!--DWLayoutEmptyCell-->  </td>
 </tr>
 <tr>
 <td height="364" colspan="2" valign="top" bgcolor="#FFFFFF"> <span class="style1"><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font></span></font></font></span></span></font></font></span></span>
 <table width="91%" border="0" align="center" cellpadding="0" cellspacing="0">
 <!--DWLayoutTable-->
 <tr>
 <td width="15" height="13" valign="bottom"><img src="image/up-left2.jpg" width="15" height="13"></td>
 <td width="9" valign="top" background="image/up3.gif">
 <td width="666" valign="top" background="image/up3.gif">
 <td width="7" valign="top" background="image/up3.gif">
 <td width="15" valign="bottom"><img src="image/up-right2.jpg" width="15" height="13"></td>
 </tr>
 <tr>
 <td height="273" background="image/left2.jpg"> </td>
 <td> </td>
 <td valign="top"><div align="center">
 <p><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><img src="image/administrator1.gif" width="220" height="165"></font></p>
 <p>
 <table width="750" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#99CCFF">
 <tr bgcolor="#d6dff7">
 <td width="67" height="21"><div align="center"><font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong><font color="#0099FF">  บทท</font></strong>ี่</font></div></td>
 <td width="452" height="21"><div align="center"><font color="#0099FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>ชื่อบทเรียน</strong></font></div></td>
 <td width="167"><div align="center"><font color="#0099FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong> บทเรียน</strong></font></div></td>
 </tr>
 <?php
 $sql="SELECT lesson_id,lesson_name FROM lesson;";
 mysql_query("set charset tis620");
 $result=mysql_query($sql);
 if($result){
 while($lesson_arr=mysql_fetch_array($result)){
 ?>
 <tr>
 <td height="26"><div align="center"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $lesson_arr[0] ?></font></div></td>
 <td><div align="left"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"> 
   <?php echo $lesson_arr[1] ?></font></div></td>
 <td><div align="center"><a href="lesson_edit.php?lesson_id=<?php echo $lesson_arr[0]; ?>%0A%09%09%09%09%09%09%09%09%09%09%09%09%09d%22sson_name=<?php echo $lesson_arr[1];
 $name_lee="lesson_id"?>">
 <font color="blue" size="2" face="MS Sans Serif, Tahoma, sans-serif">บทเรียนบทที่<?php echo $lesson_arr[0]; ?></font></a></div></td>
 </tr>
 <?php
 }//end while
 }else{
 echo "ไม่สามารถแสดงข้อมูลได้"."<br>\n";
 }
 ?>
 </table>
 <br></p>
 </div></td>
 <td> </td>
 <td background="image/right2.jpg"> </td>
 </tr>
 <tr>
 <td height="20" background="image/left2.jpg"> </td>
 <td> </td>
 <td> </td>
 <td> </td>
 <td background="image/right2.jpg"> </td>
 </tr>
 <tr>
 <td height="20" background="image/left2.jpg"> </td>
 <td> </td>
 <td valign="top"><div align="center"><br>
 <font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 </font></div></td>
 <td> </td>
 <td background="image/right2.jpg"> </td>
 </tr>
 <tr>
 <td height="20" valign="top"><img src="image/down-left3.jpg" width="15" height="11"></td>
 <td background="image/down.gif">  </td>
 <td background="image/down.gif"> </td>
 <td background="image/down.gif"> </td>
 <td valign="top"><img src="image/down-right3.jpg" width="15" height="11"></td>
 </tr>
 </table>
 <?php  include'line_index.php'; ?>
 </td>
 </tr>
 </table>
 </div></td>
 </tr>
 </table>
 </body>
 </html>
 
 
 
 อันนี้หน้าแก้ไข lesson_edit.php
 
 <? session_start();?>
 <html>
 <head>
 <title>ผู้ดูแลระบบ</title>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-874">
 <style type="text/css">
 <!--
 .style1 {font-weight: bold}
 -->
 </style>
 </head>
 <?  include("connect.php");
 if(!session_is_registered("login_true")) {
 //  url=index.php คำสั่งนี้จะให้ไปหน้าที่จะต้องกรอก user,pwd ถ้าอยู่โฟล์เดอร์อื่นให้เรียกให้ถูก
 echo"<br><br><br><br><br><br><center><img src='image/backlogin.gif'></center>";
 echo "<meta http-equiv='refresh' content='5;url=index.php'>" ;
 exit() ; }?>
 <?php session_start();
 session_register("name_l");//เก็บชื่อเรื่องเอาไว้แสดงเวลาปรับปรุง
 session_register("lesson_edit"); //เก็บบทที่
 include("connect.php");
 ?>
 <style>
 a			{font-size:12;color:#0000cc;}
 a:link		{color:#0000cc;text-decoration:none;}
 a:hover	{color:red;text-decoration:bold;}
 a:visited	{color:none;text-decoration:'none'}
 </style>
 <body >
 <div align="left">
 <table width="100%" border="0" align="center" cellspacing="1" bgcolor="#666666">
 <tr>
 <td height="257" valign="top" bgcolor="#FFFFFF"><div align="center"></div>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
 <tr bgcolor="#FFFFFF">
 <td>
 <?php  include'menubar.php'; ?>
 </td>
 </tr>
 <tr valign="top" bgcolor="#FFFFFF">
 <td>  </td>
 </tr>
 <tr>
 <td height="201" valign="top" bgcolor="#FFFFFF"> <span class="style1"><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font></span></font></font></span></span></font></font></span></span>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td width="1%" valign="bottom"><img src="image/up-left2.jpg" width="15" height="13"></td>
 <td width="97%" valign="top" background="image/up3.gif">
 <td width="2%" valign="bottom"><img src="image/up-right2.jpg" width="15" height="13"></td>
 </tr>
 <tr>
 <td height="168" background="image/left2.jpg"> </td>
 <td valign="top" bgcolor="#FFFFFF"><div align="center">
 <p><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><img src="image/administrator1.gif" width="220" height="165"></font></p>
 <p>
 <?php
 $lesson_edit="$lesson_id";
 
 $result1 = mysql_query("select * from lesson  where lesson_id ='$lesson_edit'") or die ("Err Can not to result") ;
 $rs = mysql_fetch_array($result1) ;
 $name_l=$rs['lesson_name'];
 
 echo "<center><font size='2' face='MS Sans Serif' ><font color=#0000FF><B>ปรับปรุงบทเรียน  เรื่อง</B></font>";echo  "<B><font color=#FF0000> $name_l </B></font>"; echo"<br><br>"; echo" </center></font>";
 //$result = mysql_query("SELECT no,id, q,question FROM quiz  where q='$lesson' ");
 $result = mysql_query("SELECT * FROM lessons where lesson_id='$lesson_id' ");
 //$rs = mysql_fetch_array($result);
 $qpall = $rs['title']; // ตัดคำ
 $newtext = wordwrap($qpall,20,"<\n>",1);
 
 $i = 0;
 
 echo "<table >";
 echo"<tr bgcolor='#FF582F'>     <td  width='10%'><center><font color=#FFFFFF size='2' face='MS Sans Serif'>บทที่</center></font ></td>
 <td  width='30%'><center><font color=#FFFFFF size='2' face='MS Sans Serif'>หัวเรื่อง</center></font ></td>
 <td  width='15%'><center><font color=#FFFFFF size='2' face='MS Sans Serif'>เนื้อเรื่อง</center></font ></td>
 <td  width='15%'><center><font color=#FFFFFF size='2' face='MS Sans Serif'>เนื้อหา</center></font ></td>
 <td  width='15%'><center><font color=#FFFFFF  size='2' face='MS Sans Serif'>รายละเอียด</center></font></td>
 <td   width='15%'><center><font color=#FFFFFF size='2' face='MS Sans Serif'>รายละเอียด</center></font></td>                                                             <td><center><font color=#FFFFFF size='2' face='MS Sans Serif'>แก้ไข</center></font></td>
 <td><center><font color=#FFFFFF size='2' face='MS Sans Serif'>ลบ</center></font></td>";
 while ($row = mysql_fetch_array($result))
 {
 
 $no = $row["no"];
 $id=$row["id"];
 $lesson_id=$row["lesson_id"];
 $title = $row["title"];
 //	$qpall = $row["question"]; // ตัดคำ
 //   $newtext = wordwrap($qpall,100,"<\n>",1);
 $title2 = $row["title2"];
 $dripcription = $row["dripcription"];
 $dripcription2 = $row["dripcription2"];
 $dripcription3 = $row["dripcription3"];
 
 $i++;
 if ($alternate == "1") {
 $color = "#ffffff";
 $alternate = "2";
 }
 else {
 $color = "#efefef";
 $alternate = "1";
 }
 echo "<tr bgcolor=$color>
 <td width='10%'><center><font size='2' face='MS Sans Serif'>$i</center></font ></td>
 <td width='30%'><font size='2' face='MS Sans Serif'>$title</font ></td>
 <td width='15%'><font size='2' face='MS Sans Serif'>$title2</font ></td>
 <td width='15%'><font size='2' face='MS Sans Serif'>$dripcription</font ></td>
 <td width='15%'><font size='2' face='MS Sans Serif'>$dripcription2</font ></td>
 <td width='15%'><font size='2' face='MS Sans Serif'>$dripcription3</font ></td>
 <td width='10%'><font size='2' face='MS Sans Serif'>   <a href='edit_lesson.php?hid_no=$no'><img src='image/icon_edit.gif' width='24' height='17' border='0'></a>   </font ></td>
 <td  width='10%'><font size='2' face='MS Sans Serif'>    <a href='deletelesson.php?no=$no' onClick=\"return confirm('คุณแน่ใจแล้วหรือค่ะ ว่าจะลบบทเรียนนี้ ?')\"><img src='image/delete1.gif' width='21' height='20' border='0'></a>  </font ></td></tr>";
 }
 echo "</table>";
 ?>
 <div align="center"> <br>
 <a href="lesson_add.php"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>
 </strong></font></a>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td width="48%"><div align="center"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><a href="lessons.php"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong><img src="image/less5.2_clip_image004.gif"></strong></font></a>      <a href="lesson_add.php"><img src="image/contact.gif" width="43" height="47" border="0">    <strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">เพิ่มบทเรียน</font></strong></a></div></td>
 </tr>
 </table>
 </div>
 <div align="center">
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td width="48%"> </td>
 <td width="52%"> </td>
 </tr>
 </table>
 </div>
 <br>
 </div></td>
 <td background="image/right2.jpg"> </td>
 </tr>
 <tr>
 <td height="20" valign="top"><img src="image/down-left3.jpg" width="15" height="11"></td>
 <td background="image/down.gif"> </td>
 <td valign="top"><img src="image/down-right3.jpg" width="15" height="11"></td>
 </tr>
 </table></td>
 </tr>
 <tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
 <td height="37" valign="top">
 <p>
 <?php  include'line_index.php'; ?>
 </p></td>
 </tr>
 </table></td>
 </tr>
 </table>
 </div>
 </body>
 </HTML>
 
 อันนี้หน้าเพิ่ม lesson_add.php
 <? session_start();
 session_register("n1");//เก็บค่าข้อต่อไป
 ?>
 
 <style>
 a			{font-size:15;color:#0033FF;}
 a:link		{color:#0000cc;text-decoration:none;}
 a:hover   	{color:red;text-decoration:bold;}
 a:visited	{color:none;text-decoration:'none'}
 </style>
 <title>ผู้ดูแลระบบ</title>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-874">
 <table width="100%" border="0" align="center" cellspacing="1" bgcolor="#666666">
 <tr>
 <td height="257" valign="top" bgcolor="#FFFFFF"><div align="center"></div>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
 <tr bgcolor="#FFFFFF">
 <td>
 <?php  include'menubar.php'; ?>
 </td>
 </tr>
 <tr valign="top" bgcolor="#FFFFFF">
 <td>  </td>
 </tr>
 <tr>
 <td height="201" valign="top" bgcolor="#FFFFFF"> <span class="style1"><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font><span class="style10"><font color="#1D67F1" size="1" face="MS Sans Serif, Tahoma, sans-serif"><font color="#000000" size="2"><span class="style1"><font color="#4558AF" face="MS Sans Serif, Tahoma, sans-serif">
 </font></span></font></font></span></span></font></font></span></span>
 <table width="63%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td width="1%" valign="bottom"><img src="image/up-left2.jpg" width="15" height="13"></td>
 <td width="97%" valign="top" background="image/up3.gif">
 <td width="2%" valign="bottom"><img src="image/up-right2.jpg" width="15" height="13"></td>
 </tr>
 <tr>
 <td height="168" background="image/left2.jpg"> </td>
 <td valign="top" bgcolor="#FFFFFF"><div align="center">
 <table width="700" height="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#66CCFF" bgcolor="#FFFFFF">
 <tr>
 <td align="center" valign="top"><p align="center"><strong><font color="#0000CC" size="3" face="MS Sans Serif">
 <br></font><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><img src="image/administrator1.gif" width="220" height="165" /></font></strong>
 <?php
 include("connect.php");
 
 $sql_query = "SELECT MAX(id) as MAXID  FROM lessons where lesson_id='$lesson_edit'";  //อันนี้ใช้ random ทั้งหมดจากฐานข้อมูลใช้ในแบบทดสอบรวม
 $result = mysql_db_query($dbname,$sql_query);
 
 //	echo $num_row;
 $num_id=$rs['MAXID'];
 $n1=$num_id+1;
 //echo $n1;
 
 
 if($submit)  //เพิ่ม
 {
 //	$pall =htmlspecialchars($question);
 $pall =addslashes($title);//แปลงอักขระ
 $palltitle2 =addslashes($title2);
 $palldripcription =addslashes($dripcription);
 $palldripcription2 =addslashes($dripcription2);
 $palldripcription3 =addslashes($dripcription3);
 
 $sql = "INSERT INTO lessons (lesson_id,title, title2, dripcription, dripcription2,dripcription3) VALUES ('$lesson_edit','$pall','$palltitle2','$palldripcription','$palldripcription2','$palldripcription3')";
 
 $result = mysql_query($sql);
 //echo "<b><font face='ms sans serif' size='3' color='#FF0099'><br><br><br><br>ขณะนี้ระบบได้ทำการเพิ่มแบบทดสอบเรียบร้อยแล้วค่ะ<br>รอสักครู่เพื่อกลับหน้าจัดการแบบทดสอบ<br>\n</font></b>";
 echo "<meta http-equiv='refresh' content='0;url=lesson_edit.php?lesson_id=$lesson_edit'>" ;
 //	$rs = mysql_fetch_row($result) ;
 //	$new_id=$rs['id'];
 //echo "<br><br>Question added to quiz.<br><br>";
 //include "qinsert.php";
 }
 else if($update)  //แก้ไข
 {
 $pall =addslashes($title);
 $palltitle2 =addslashes($title2);
 $palldripcription =addslashes($dripcription);
 $palldripcription2 =addslashes($dripcription2);
 $palldripcription3 =addslashes($dripcription3);
 $sql = "UPDATE lessons SET lesson_id='$lesson_edit',title='$pall',title2='$palltitle2',dripcription='$palldripcription',dripcription2='$palldripcription2',dripcription3='$palldripcription3' WHERE no='$no'";
 $result = mysql_query($sql);
 //echo "<b><font face='ms sans serif' size='3' color='#FF0099'><br><br><br><br>ขณะนี้ระบบได้ทำการปรับปรุงแบบทดสอบเรียบร้อยแล้วค่ะ<br>รอสักครู่เพื่อกลัหน้าจัดการแบบทดสอบ<br>\n</font></b>";
 echo "<meta http-equiv='refresh' content='0;url=lesson.editphp'>" ;
 }
 else if($no)
 {
 $result = mysql_query("SELECT * FROM lessons WHERE no='$no'");
 $myrow = mysql_fetch_array($result);
 ?>
 <!--  แก้ไข -->
 </p>
 <form name ="checkForm1" method="post" action="<?php echo $PHP_SELF?>" onSubmit="return check()">
 <table width="86%" border="0" align="center" cellpadding="0" cellspacing="2">
 <tr>
 <td height="21"> <div align="left"><br>
 </div></td>
 <td><div align="center"><font color="#FF9933"><font color="#000000" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong><font color="#0033FF">เรื่อง</font><font color="#006600"> </font></strong></font>
 </font><font color="#0033FF" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong><? echo $name_l;?></strong></font>
 </div></td>
 </tr>
 <tr bgcolor="#FFFFFF">
 <td width="23%" height="73"><div align="right"><font color="#009900"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">หัวเรื่อง  </font></strong></font></div></td>
 <td width="77%"><div align="left"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 <textarea   name="title"  rows="4"  cols ="50"  wrap="on"><?=$myrow['title']?></textarea>
 <!-- <input type="Text" name="question" ROWS="4"  value="<?php echo $myrow["title"]?>" size="50">   -->
 </font></strong></font></div></td>
 </tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><font color="#009900"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">เนื้อเรื่อง  </font></strong></font></div></td>
 <td><div align="left"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 <textarea   name="title2"  rows="2"  cols ="50"  wrap="on"><?echo $myrow["title2"]?></textarea>
 <!--     <input type="Text" name="opt1" value="<?php echo $myrow["title2"]?>" size="30"> -->
 </font></strong></font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><font color="#009900"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">เนื้อหา  </font></strong></font></div></td>
 <td><div align="left"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 <textarea   name="dripcription"  rows="2"  cols ="50"  wrap="on"><?echo $myrow["dripcription"]?></textarea>
 <!--     <input type="Text" name="opt2" value="<?php echo $myrow["dripcription"]?>" size="30"> -->
 </font></strong></font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><font color="#009900"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">รายละเอียด  </font></strong></font></div></td>
 <td><div align="left"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 <textarea   name="dripcription2"  rows="2"  cols ="50"  wrap="on"><?echo $myrow["dripcription2"]?></textarea>
 <!--    <input type="Text" name="opt3" value="<?php echo $myrow["dripcription2"]?>" size="30"> -->
 </font></strong></font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><font color="#009900"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">รายละเอียด  </font></strong></font></div></td>
 <td><div align="left"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
 <textarea   name="dripcription3"  rows="2"  cols ="50"  wrap="on"><?echo $myrow["dripcription3"]?></textarea>
 <!-- 	<input type ="text" name="opt4" value="<? echo$myrow["dripcription3"]?>" size="30"> -->
 </font></strong></font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td height="20"><div align="right"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><font color="#0033FF"> </font></font>
 </strong></font></div></td>
 <td height="20"><div align="center"><font color="#009900"><strong><font size="2" face="MS Sans Serif, Tahoma, sans-serif"> <font color="#0033FF">
 </font>   <font color="#0033FF"> </font></font></strong></font></div></td>
 </tr>
 <tr>
 <td colspan="2"><div align="center">
 <input type="Submit" name="update" value="  ตกลง   ">
 <script language="javascript">
 
 function check() {
 if(document.checkForm1.title.value=="") {
 alert("กรุณากรอก หัวเรื่องด้วยค่ะ") ;
 document.checkForm1.title.focus() ;
 return false ;
 }
 else if(document.checkForm1.title2.value=="") {
 alert("กรุณากรอก เนื้อเรื่องด้วยค่ะ") ;
 document.checkForm1.title2.focus() ;
 return false ;
 }
 else if(document.checkForm1.dripcription.value=="") {
 alert("กรุณากรอก เนื้อหาด้วยค่ะ") ;
 document.checkForm1.dripcription.focus() ;
 return false ;
 }
 else if(document.checkForm1.dripcription2.value=="") {
 alert("กรุณากรอก รายละเอียดด้วยค่ะ") ;
 document.checkForm1.dripcription2.focus() ;
 return false ;
 }else if(document.checkForm1.dripcription3.value=="") {
 alert("กรุณากรอก รายละเอียดด้วยค่ะ") ;
 document.checkForm1.dripcription3.focus() ;
 return false ;
 }
 else
 return true ;
 }
 </script>
 </div></td>
 </tr>
 </table>
 </form>
 <!-- <input type="Submit" name="update" value="Update information"></form> -->
 <?
 
 }
 else //เพิ่ม
 {
 ?>
 <!--  เพิ่ม -->
 <div align="center"></div>
 <form name ="checkForm" method="post" action="<?php echo $PHP_SELF?>" onSubmit="return check()">
 <table width="86%" border="0" align="center" cellpadding="0" cellspacing="2">
 <tr>
 <td colspan="2"><strong><font color="#0033FF" size="3" face="MS Sans Serif, Tahoma, sans-serif">เรื่อง 
 </font></strong> <font color="#0033FF" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong>
 <?echo $name_l;?> </strong></font><font color="#000000" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong><br>
 </strong></font> </td>
 </tr>
 <tr bgcolor="#FFFFFF">
 <td width="23%"><div align="right"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">หัวเรื่อง  </font></strong></div></td>
 <td width="77%"> <div align="left"><font color="#009900">
 <textarea   name="title"  rows="4"  cols ="50"  wrap="on"><?=$myrow['title']?></textarea>
 <!--     <input type="Text" name="question" size="50"> -->
 </font></div></td>
 </tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">เนื้อเรื่อง  </font></strong></div></td>
 <td> <div align="left"><font color="#009900">
 <textarea   name="title2"  rows="2"  cols ="50"  size="70"  wrap="on"><?echo $myrow["title2"]?></textarea>
 <!--     <input type="Text" name="opt1" size="30"> -->
 </font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">เนื้อหา  </font></strong></div></td>
 <td> <div align="left"><font color="#009900">
 <textarea   name="dripcription"  rows="2"  cols ="50"  size="70"  wrap="on"><?echo $myrow["dripcription"]?></textarea>
 <!--       <input type="Text" name="opt2" size="30"> -->
 </font></div></td></tr>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">รายละเอียด  </font></strong></div></td>
 <td> <div align="left"><font color="#009900">
 <textarea   name="dripcription2"  rows="2"  cols ="50"  size="70"  wrap="on"><?echo $myrow["dripcription2"]?></textarea>
 <!--       <input type="Text" name="opt3" size="30"> -->
 </font>
 <tr bgcolor="#FFFFFF">
 <td><div align="right"><strong><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">รายละเอียด  </font></strong></div></td>
 <td> <div align="left"><font color="#009900">
 <textarea   name="dripcription3"  rows="2"  cols ="50"  size="70"  wrap="on"><?echo $myrow["dripcription3"]?></textarea>
 <!--      <input type="Text" name="opt4" size="30"> -->
 </font>
 <tr valign="top" bgcolor="#FFFFFF">
 <td height="21"><div align="right"><font color="#009900" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong></strong></font><font color="#0033FF" size="2" face="MS Sans Serif"><strong><font face="MS Sans Serif, Tahoma, sans-serif"> </font></strong></font></div></td>
 <td height="21"><div align="center"><font color="#009900" size="2" face="MS Sans Serif"><strong>
      </strong></font></div></td>
 </tr>
 <tr>
 <td colspan="2"><div align="center">
 <input name="submit" type="Submit" value="  ตกลง  " >
 <script language="javascript">
 
 function check() {
 if(document.checkForm.title.value=="") {
 alert("กรุณากรอก หัวเรื่องด้วยค่ะ") ;
 document.checkForm.title.focus() ;
 return false ;
 }
 else if(document.checkForm.title2.value=="") {
 alert("กรุณากรอก เนื้อเืรื่องด้วยค่ะ") ;
 document.checkForm.title2.focus() ;
 return false ;
 }
 else if(document.checkForm.dripcription.value=="") {
 alert("กรุณากรอก เนื้อหาด้วยค่ะ") ;
 document.checkForm.dripcription.focus() ;
 return false ;
 }
 else if(document.checkForm.dripcription2.value=="") {
 alert("กรุณากรอกต รายละเอียดด้วยค่ะ") ;
 document.checkForm.dripcription2.focus() ;
 return false ;
 }else if(document.checkForm.dripcription3.value=="") {
 alert("กรุณากรอก รายละเอียดด้วยค่ะ") ;
 document.checkForm.dripcription3.focus() ;
 return false ;
 }
 else
 return true ;
 }
 </script>
 </div></td>
 </tr>
 </table>
 </form>
 <font color="#0000CC" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong>
 </strong></font> <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td width="41%"><div align="right"><font color="#0000CC" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong>
 <?
 }//	echo $sql;
 ?>
 <!-- <a href="editquizlist.php">ดูข้อสอบทั้งหมด</a> -->
 </strong><a href="lesson_edit.php?$lesson_arr[0]"></a></font><font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"> 
 </font><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font><font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><a href="lesson_edit.php"><strong></strong></a> </font></div></td>
 <td width="59%"> </td>
 </tr>
 </table>
 
 <font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><a href="lesson_edit.php?$lesson_id=$id"><br>
 </a></font> </td>
 </tr>
 </table>
 <p>  </div></td>
 <td background="image/right2.jpg"> </td>
 </tr>
 <tr>
 <td height="20" valign="top"><img src="image/down-left3.jpg" width="15" height="11"></td>
 <td background="image/down.gif"> </td>
 <td valign="top"><img src="image/down-right3.jpg" width="15" height="11"></td>
 </tr>
 </table></td>
 </tr>
 <tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
 <td height="18" valign="top"> <p>
 <?php  include'line_index.php'; ?>
 </p></td>
 </tr>
 </table></td>
 </tr>
 </table>
 </body>
 </HTML>
 
 ในฐานข้อมูลมีตารางดังนี้ค่ะ
 
 -- phpMyAdmin SQL Dump
 -- version 2.10.2
 -- http://www.phpmyadmin.net
 --
 -- โฮสต์: localhost
 -- เวลาในการสร้าง: 03 พ.ย. 2008  น.
 -- รุ่นของเซิร์ฟเวอร์: 5.0.45
 -- รุ่นของ PHP: 5.2.3
 
 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
 --
 -- ฐานข้อมูล: `db_comm`
 --
 
 -- --------------------------------------------------------
 
 --
 -- โครงสร้างตาราง `lessons`
 --
 
 CREATE TABLE `lessons` (
 `no` int(11) NOT NULL auto_increment,
 `lesson_id` int(3) NOT NULL default '0',
 `title` text NOT NULL,
 `title2` text NOT NULL,
 `dripcription` text NOT NULL,
 `dripcription2` text NOT NULL,
 `dripcription3` text NOT NULL,
 PRIMARY KEY  (`no`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=tis620 AUTO_INCREMENT=160 ;
 
 ซึ่งพอทำเสร็จก็สามารถเพิ่มลบแก้ไขได้ แต่ว่าจะเอาข้อมูลมาใช้ต้องทำยังไงค่ะ ช่วยด้วยค่ะทุกคน
 
 
 ขอบคุณล่วงหน้าค่ะ
 
 
 ก้อย
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Tag : - - - -
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          3 พ.ย. 2551  17:23:40 | By :
                          ก้อย | View :
                          1311 | Reply :
                          1 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมก็ไม่ค่อยเข้าใจคำถามนะครับ 
 สามารถ เพิ่ม ลบ แก้ไข ได้ แต่ไม่สามารถเอาข้อมูลมาใช้ได้?
 
 เวลาดึงข้อมูลก็ select from where นะครับ    --น่าจะถูกนะ
 
 แล้วฟีล no นี่คืออะไรครับ แล้ว lession_id ล่ะ
 แล้ว dripcription แปลว่าอะไร
 
 ถ้าตอบไม่ถูกขออภัยด้วย
 
 แสดงหัวข้อ
 
 $query = mysql_query("SELECT * FROM lessions");
 
 while( $result = mysql_fetch_array($query) )
 echo 'บทเรียน <a href=show.php?no="', $result['no'], '">', $result['title'], '</a><br>';
 
 //หน้า show.php ก็แสดงข้อมูล
 $query = mysql_query("SELECT * FROM lessions WHERE no=$no");
 $result = mysql_fetch_array($query);
 
 echo $result['dripcription'], '<br><br>';
 echo $result['dripcription2'], '<br><br>';
 echo $result['dripcription3'], '<br><br>';
 
 
 ผมว่าน่าจะประมาณนี้
 
 
 http://gunner.freetzi.com
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            3 พ.ย. 2551  21:58:23 | By :
                            เอี่ยว |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |