|  |  | 
          
            | ทำยังไงถึงจะให้ รวมข้อมูลของโรคแล้วอยู่ในแค่ตารางเดียวค่ะ 
 
 
  
 code :หน้าค้นหาข้อมูลแล้ว
 
 Code (PHP)
 
  <?php 
 //รับค่าจาก textbox มาเก็บไว้ในตัวแปร
$word1 =  $_POST["word1"]; 
$word2 =  $_POST["word2"]; 
$word3 =  $_POST["word3"]; 
$word4 =  $_POST["word4"]; 
$word5 =  $_POST["word5"];
//คำสั่งติดต่อฐานข้อมูล
$objConnect = mysql_connect("127.0.0.1","root","") or die("Error Connect to Database");
//ชื่อฐานข้อมูล
$objDB = mysql_select_db("disease_db");
mysql_query("SET NAMES UTF8"); //ให้แสดงภาษาไทย
//ตำสั่งดึงข้อมูล
$strSQL = "SELECT id_de, detail.id_di, organs, disease, intro,cause, symptem,refer,pic_or
FROM detail 
LEFT JOIN disease ON detail.id_di = disease.id_di  where detail.id_di in ('$word1','$word2','$word3','$word4','$word5')  ";
//คำสั่งทำงาน
$objQuery = mysql_query($strSQL) or die ("Error Query  [".$strSQL."]");
?>
<html>
<head>
<title>Expert shirt model</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<style type="text/css">
body {
	background-image: url(bg2.jpg);
}
body,td,th {
	color: #000;
}
</style>
</head>
<body>
<div align="center"><!-- ส่วนหัวตาราง -->
 <table width="1075" height="34" border="0">
    <tr>
      <td width="6"> <td width="1059" height="289"><img src="หน้าปก.gif" width="1065" height="291" /></td>
    </tr>
  </table>
  <table width="1082" height="304" border="1">
    <tr>
      <th width="194" bgcolor="#0066FF">รูปอวัยวะ</th>
      <th width="117" bgcolor="#0066FF"> <div align="center">หมายเลขสำรวจ </div></th>
      <th width="142" bgcolor="#0066FF"> <div align="center">อวัยวะ</div></th>
      <th width="612" bgcolor="#0066FF"> <div align="center">โอกาสที่จะเกิดโรค</div></th>
    </tr>
  <?php
//ทำการเช็คว่ามีการอ่านข้อมูลหรือไม่ ถ้ามีให้แสดงข้อมูล
while($objResult = mysql_fetch_array($objQuery))
{
?>
  <!-- ส่วนแสดงข้อมูล -->
    <meta http-equiv=Content-Type content="text/html; charset=utf-8">
    <tr>
      <td><div align="center"><img src="img/<?php echo $objResult["pic_or"];?>" width="200"></div></td>
      <td><div align="center"><?php echo $objResult["id_di"];?></div></td>
      <td><div align="center"><?php echo $objResult["organs"];?></div></td>
      <td><?php echo $objResult["disease"];?></td>
    </tr>
  <?php
}
?>
  </table>
  
</div>
<p>
  <?php
mysql_close($objConnect); //ผปิดการติดต่อฐานข้อมู,
?>
</p>
<p> </p>
<p>  </p>
<form name="form1" method="post" action="index1.php">
  <div align="center">
    <input type="submit" name="btnback" id="btnback" value="ย้อนกลับ">
  </div>
</form>
<div align="justify"></div>
<div align="center"></div>
</body>
</html>
 
 
 Tag : PHP, MySQL
 
 
 |  
            | 
 ประวัติการแก้ไข
 2017-05-26 22:16:04
 2017-05-27 13:46:25
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2017-05-26 22:13:33 | By :
                          royyim88 | View :
                          694 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |