|
 |
|
สอบถามปัญหาในการ เช็ค สถานะ อะครับ มีการ join กัน 3 ตาราง |
|
 |
|
|
 |
 |
|
น่าจะอย่างนี้มั้งนะ 
Code (PHP)
<?php
session_start();
require_once("config.php");
//ini_set('display_errors', 1);
//error_reporting(~0);
//if(isset($_GET['Thesis_ID'])){ //ส่วนนี้รับค่าตัวแปลมาจากการ form search
$strThesis_ID = $_GET['Thesis_ID'];
$sql = "SELECT * FROM thesis_teacher";
$sql .= " LEFT JOIN thesis ON thesis_teacher.Thesis_ID = thesis.Thesis_ID";
$sql .= " LEFT JOIN teacher ON thesis_teacher.Teacher_ID = teacher.Teacher_ID";
$sql .= " WHERE thesis_teacher.TeacherType = 'A' AND thesis.Thesis_ID = '".$strThesis_ID."'";
$query = mysqli_query($conn,$sql) or die ( $sql . "<br>" . mysqli_error($conn) );
$result = mysql_fetch_assoc($query);
//}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="CSS/Css_mainframe.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="detail" align="center">
<table width="801" height="217" border="1" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2"><div align="center">รายละเอียดอย่างย่อวิทยานิพนธ์</div></td>
</tr>
<tr>
<td width="170"><div align="center">เลขที่วิทยานิพนธ์</div></td>
<td width="618"><?php echo $result['Thesis_ID']; ?></td>
</tr>
<tr>
<td><div align="center">ชื่อวิทยานิพนธ์</div></td>
<td><?php echo $result['Thesis_name']; ?></td>
</tr>
<tr>
<td><div align="center">ประจำปีการศึกษา</div></td>
<td><?php echo $result['Thesis_year']; ?></td>
</tr>
<tr>
<td><div align="center">ภาควิชา</div></td>
<td><?php echo $result['Department_name']; ?></td>
</tr>
<tr>
<td><div align="center">ผู้จัดทำ</div></td>
<td><?php echo $result['Student_name']; ?></td>
</tr>
<tr>
<td><div align="center">อาจารย์ที่ปรึกษา</div></td>
<td><?php echo $result['Teacher_name'];?></td>
</tr>
<?php
$sql2 = "SELECT * FROM thesis_teacher";
$sql2 .= " LEFT JOIN thesis ON thesis_teacher.Thesis_ID = thesis.Thesis_ID";
$sql2 .= " LEFT JOIN teacher ON thesis_teacher.Teacher_ID = teacher.Teacher_ID";
$sql2 .= " WHERE thesis_teacher.TeacherType = 'C' AND thesis.Thesis_ID = '".$strThesis_ID."'";
$query2 = mysqli_query($conn,$sql2) or die ( $sql2 . "<br>" . mysqli_error($conn) );
while($result2 = mysql_fetch_assoc($query2)){
?>
<tr>
<td><div align="center">กรรมการ <?=++$n;?></div></td>
<td><?php echo $result2['Teacher_name']; ?></td>
</tr>
<?php } ?>
<tr>
<td><div align="center">บทคัดย่อ</div></td>
<td><?php echo $result["Abstact"]; ?></td>
</tr>
<tr>
<td><div align="center">คำสำคัญ</div></td>
<td><?php echo $result["Thesis_word"]; ?></td>
</tr>
<tr>
<td><div align="center">ดาวน์โหลด</div></td>
<td><?php
if(!isset($_SESSION['User_ID'])){
echo "<a href=\"frm_login.php\">ไม่สามารถดาวน์โหลดได้กรุณาเข้าสู่ระบบ</a>";
exit();
}else{
echo "";
}
?>
</td>
</tr>
</table>
<?php mysqli_close($conn); ?>
</div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2014-12-17 04:32:24 |
By :
sabaitip |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|