|
|
|
PHP ดึงข้อมูลจากฐานข้อมูล จาก Web Server ที่เป็น IIS แล้วไม่ขึ้นครับ |
|
|
|
|
|
|
|
อันนี้โค้ดครับ ตรงช่วงที่เป็นlist menu มันขึ้นเป็น "> แต่จำนวนที่ขึ้นเท่ากับข้อมูลในฐานข้อมูลเลย
Code (PHP)
<?php
session_start();
if($_SESSION['id_user'] == "")
{
echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"2;URL=index.php\">";
echo "<center><font size=+3><br><br>Please Login!</font></center>";
exit();
}
session_start();
if($_SESSION['status'] != "10" && $_SESSION['status'] != "70")
{
echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"2;URL=index.php\">";
echo "<center><font size=+3><br><br>This account has not been approved!</font></center>";
exit();
}
mysql_connect("localhost","root","bkkedu@2011");
mysql_select_db("evaluate_training");
mysql_query("SET NAME utf8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$strSQL = "SELECT * FROM user WHERE id_user = '".$_SESSION['id_user']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!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>
<meta name="keywords" content="pink, business, website themes, design, free templates, website templates, CSS, HTML" />
<meta name="description" content="Pink Business Theme is a free website template from templatemo.com for all web designers and webmasters." />
<link href="templatemo_311_pink_business/templatemo_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="templatemo_311_pink_business/content_slider_style.css" />
<script type="text/javascript" src="templatemo_311_pink_business/js/jquery.1.3.2.min.js" ></script>
<script type="text/javascript" src="templatemo_311_pink_business/js/jquery-ui.min.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 3000, true);
});
</script>
</head>
<body>
<div id="templatemo_body_top">
<div id="templatemo_body_bottom">
<div id="templatemo_wrapper">
<div id="templatemo_header">
<div id="site_title">
<h1><a ><span><font size="7"><strong>ตรวจสอบแบบประเมินผลการอบรม</strong></font></span></a></h1>
</div> <!-- end of site_title -->
</div>
<?php
if ($_SESSION['status'] == "70")
{
?>
<div id="templatemo_menu">
<ul>
<li><a href="Administrator.php"><span><font size="5"><strong>กลับหน้าหลัก</strong></font></span></a></h1></li>
<li><a href="addcourse.php"><span><font size="5"><strong>เพิ่มหลักสูตร</strong></font></span></a></li>
<li><a href="sumprint1.php" target="_blank"><span><font size="5"><strong>พิมพ์สรุปแบบประเมิน</strong></font></span></a></li>
<li><a href="logout.php"><span><font size="5"><strong>ออกจากระบบ</strong></font></span></a></li>
<li></li>
</ul>
</div>
<?php
}
else if(($_SESSION['status'] != "70")){
?>
<div id="templatemo_menu">
<ul>
<li><a href="admin1.php"><span><font size="5"><strong>อัพเดตหลักสูตร</strong></font></span></a></h1></li>
<li></li>
<li><a href="sumprint1.php" target="_blank"><span><font size="5"><strong>พิมพ์สรุปแบบประเมิน</strong></font></span></a></li>
<li><a href="logout.php"><span><font size="5"><strong>ออกจากระบบ</strong></font></span></a></li>
<li></li>
</ul>
</div>
<?php
}
?>
<!-- end of templatemo_menu -->
<div id="templatemo_main_wrapper_01">
<div id="templatemo_main_wrapper_02">
<div id="templatemo_main_wrapper_03">
<div id="templatemo_main">
<div id="templatemo_slider"> <form id="form1" name="form1" method="post" action="?" />
<p>
<?php $strSQL = "SELECT * FROM collected1";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery); ?>
หลักสูตร
<label>
<select name="course" id="course" >
<option value="0" selected="selected"> กรุณาเลือกหลักสูตร</option>
<?php
$course=$_POST['m_id'];
$strSQL = "SELECT * FROM coursemain ORDER BY m_id ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($course == $objResult['course']){
}
?>
<option value="<?php =$objResult["m_id"];?>" >
<?php =$objResult["course"];?>
</option>
<?php
}
?>
</select>
</label>
รุ่น
<label>
<select name="ver" id="ver" >
<option value="0" selected="selected">กรุณาเลือกรุ่น</option>
<?php
$ver=$_POST['v_id'];
$strSQL = "SELECT * FROM version ORDER BY v_id ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($ver == $objResult['ver']){
}
?>
<option value="<?php =$objResult["ver"];?>" >
<?php =$objResult["ver"];?>
</option>
<?php
}
?>
</select>
</label>
<?php $coursee=$_POST['course'];
$verr=$_POST['ver'];
$strSQL = "SELECT * FROM collected1 WHERE ver='$verr' and m_id ='$coursee';";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);?>
<label>
<input type="submit" name="ค้นหา" id="ค้นหา" value="ตกลง" /> ระหว่างวันที่ <?php =$objResult["date"];?>
</label>
</form></p>
<p>ชื่อวิทยากร <?php =$objResult["teacher"];?> สถานที่ <?php =$objResult["add"];?></p>
</div>
</div>
<?php
if($_POST)
{
$verr=$_POST['ver'];
$coursee=$_POST['course'];
if((!empty($verr)) && (!empty($coursee))){
$strSQL= "SELECT id_c,c.id_user,c.ver,c.q1,c.q2,c.q3,c.q4,c.q5,c.q6,c.q7,c.q8,c.q9,c.q10,c.q11,c.q12,c.q13,c.q14,c.q15,c.Suggestions
FROM collected1 c , version v ,coursemain m
WHERE (v.ver = c.ver) and (c.ver = '$verr' and m.m_id ='$coursee') AND c.m_id LIKE '%".$coursee."%' AND c.ver LIKE '%".$verr."%' AND c.ver LIKE '%".$verr."%'";
$objQuery = mysql_query($strSQL) or die(mysql_error());
$row = mysql_num_rows($objQuery);
echo " "." มีข้อมูลจำนวน ".$row." แถว ";
}
else if((!empty($verr))){
$strSQL= "SELECT DISTINCT id_c,c.id_user,c.ver,c.q1,c.q2,c.q3,c.q4,c.q5,c.q6,c.q7,c.q8,c.q9,c.q10,c.q11,c.q12,c.q13,c.q14,c.q15,c.Suggestions
FROM collected1 c , version v ,coursemain m
WHERE (v.ver = c.ver) and (c.ver = '$verr') AND c.ver LIKE '%".$verr."%'";
$objQuery = mysql_query($strSQL) or die(mysql_error());
$row = mysql_num_rows($objQuery);
echo " "." มีข้อมูลจำนวน".$row. " แถว";
}
else if((!empty($coursee))){
$strSQL= "SELECT DISTINCT id_c,c.id_user,c.ver,c.q1,c.q2,c.q3,c.q4,c.q5,c.q6,c.q7,c.q8,c.q9,c.q10,c.q11,c.q12,c.q13,c.q14,c.q15,c.Suggestions
FROM collected1 c , version v ,coursemain m
WHERE (m.m_id = c.m_id) and (c.m_id ='$coursee') AND c.m_id LIKE '%".$coursee."%'";
$objQuery = mysql_query($strSQL) or die(mysql_error());
$row = mysql_num_rows($objQuery);
echo " "."มีข้อมูลจำนวน ".$row." แถว";
}
?>
<center>
<table width="897" border="1" bordercolor="#4A2547" cellpadding="0" cellspacing="0" class="sp2">
<tr>
<th width="4%" nowrap="nowrap" bgcolor="#E6D8E0">เลขที่</th>
<th width="3%" height="40" nowrap="nowrap" bgcolor="#E6D8E0">ผู้ใช้</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">1</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">2</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">3</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">4</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">5</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">6</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">7</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">8</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">9</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">10</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">11</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">12</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">13</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">14</th>
<th width="3%" nowrap="nowrap" bgcolor="#E6D8E0">15</th>
<th width="24%" nowrap="nowrap" bgcolor="#E6D8E0">ข้อเสนอแนะ
</th>
<th width="4%" nowrap="nowrap" bgcolor="#E6D8E0">แก้ไข</th>
<th width="4%" nowrap="nowrap" bgcolor="#E6D8E0">ลบ</th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<th width="4%"><?php =$objResult["id_c"];?></th>
<th width="3%"><?php =$objResult["id_user"];?></th>
<th width="3%"><?php =$objResult["q1"];?></th>
<th width="3%"><?php =$objResult["q2"];?></th>
<th width="3%"><?php =$objResult["q3"];?></th>
<th width="3%"><?php =$objResult["q4"];?></th>
<th width="3%"><?php =$objResult["q5"];?></th>
<th width="3%"><?php =$objResult["q6"];?></th>
<th width="3%"><?php =$objResult["q7"];?></th>
<th width="3%"><?php =$objResult["q8"];?></th>
<th width="3%"><?php =$objResult["q9"];?></th>
<th width="3%"><?php =$objResult["q10"];?></th>
<th width="3%"><?php =$objResult["q11"];?></th>
<th width="3%"><?php =$objResult["q12"];?></th>
<th width="3%"><?php =$objResult["q13"];?></th>
<th width="3%"><?php =$objResult["q14"];?></th>
<th width="3%"><?php =$objResult["q15"];?></th>
<th width="24%" align="left"><?php =$objResult["Suggestions"];?> </th>
<th><a href="sum1edit.php?id_c=<?php =$objResult["id_c"];?><img src='img/icon/pencile.png'></a></th>
<th><center><a href="sum1del.php?id_c=<?php =$objResult["id_c"];?><img src='img/icon/delete_16.png'></a></center></th>
</tr>
<?php
}
?>
</table></center>
<?php
} ?>
</div>
<!-- end of templatemo_slider -->
<!-- end of templatemo_slider -->
<div class="cleaner"></div>
<div class="cleaner"></div>
</div><div class="cleaner"></div>
</div>
</div>
<div id="templatemo_footer"></div>
</div>
</div>
</div>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2013-04-05 12:28:49 |
By :
white31969 |
View :
913 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยดูให้ทีนะครับด่วนมากเลยย
|
|
|
|
|
Date :
2013-04-05 13:16:19 |
By :
white31969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mysql_connect("localhost","root","bkkedu@2011") or die (mysql_error());
mysql_select_db("evaluate_training") or die (mysql_error());
มี Error มั้ยครับ
|
|
|
|
|
Date :
2013-04-05 13:39:43 |
By :
Ex-[S]i[L]e[N]t |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับผม ต้องเป็น<?php ?> ทุกตัว แล้ว <?php =$objResult["fild"];?> ก็ไม่ได้ ต้องเป็น<?php echo $objResult["fild"];?>
ขอบคุณมากครับ
|
|
|
|
|
Date :
2013-04-05 14:16:49 |
By :
white31969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|