|
|
|
พี่ๆช่วยดูโค้ดให้หน่อยน่ะคะ ทำไม PROGRAMID บันทึกลงฐานข้อมูลไม่ได้ค่ะ |
|
|
|
|
|
|
|
ส่วนอื่นสามารถบันทึกลงฐานได้แต่ติดตรง PROGRAMID ที่ยังบันทึกไม่ลงฐานค่ะ
โค้ดหน้าฟอร์ม
Code (PHP)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>การจัดการผลการเรียนรู้</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-jqcascading.js"></script>
<script type="text/javascript">
// Specify a function to execute when the DOM is fully loaded.
$(function(){
$("#model").cascading( { next: '#model', parent:"#brand" } );
$("#model_des").cascading( { next: '#model_des', parent:"#model"});
});
</script>
<style type="text/css">
<!--
.style7 {font-size: 24px}
body,td,th {
font-family: Angsana New;
font-size: 18px;
}
a {
font-family: Angsana New;
font-size: 18px;
}
h1,h2,h3,h4,h5,h6 {
font-family: Angsana New;
}
h1 {
font-size: 18px;
}
.style11 {font-size: 18px}
.style15 {font-size: 24px; font-weight: bold; }
.style9 {font-size: 24px; color: #EE0000; }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<form action="<?=$_SERVER['SCRIPT_NAME'];?>" method="get" name="frmSearch" id="frmSearch" onClick="">
<?
include ("connect_db.php");
$strSQL = "SELECT DISTINCT EVALUATE.TQF.PROGRAMID,AVSREG.PROGRAM.PROGRAMNAME FROM EVALUATE.TQF
Inner Join AVSREG.PROGRAM ON EVALUATE.TQF.PROGRAMID = AVSREG.PROGRAM.PROGRAMID";
$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
?>
<table width="599" border="0">
<tr>
<td width="200" align="right" valign="middle"> </td>
<td width="600" height="20" align="left" valign="middle"> </td>
<td width="200" height="44" align="right" valign="middle"><?php /*?><span class="style7">เทอม:</span><?php */?></td>
<td width="600" height="20" align="left" valign="middle"> </td>
</tr>
</tr>
<?php /*?><th colspan="3" align="center" valign="middle"><span class="style9">**เลือกสาขาวิชาที่ต้องการแก้ไขเกณฑ์ TQF**</span></th><?php */?>
</tr>
<tr>
<th width="200" align="right"> </th>
<th width="200" align="left"> </th>
<th align="center" valign="middle">
<table width="532" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td height="30" colspan="2" align="center"><span class="style9">**เลือกสาขาวิชาที่ต้องการจัดการผลการเรียนรู้**</span></td>
</tr>
<tr>
<td width="200" align="right"><span class="style7">สาขาวิชา :</span></td>
<td width="600" align="left"><select name="PROGRAMID" size="1"><option value=["PROGRAMID"]>--เลือก--</option>
<?
while($objResult = oci_fetch_array($objParse,OCI_BOTH))
{
?>
<font size="+2">
<option value="<?=$objResult["PROGRAMID"];?>"><?=$objResult["PROGRAMNAME"];?></option>
</font>
<?
}
?>
<?
oci_close($objConnect);
?>
</select>
<input name="submit" type="submit" value=" ค้นหา " /></td>
</tr>
</table></th>
</tr>
</form>
<table width="850" border="0" align="center" cellpadding="1" cellspacing="0">
<td align="left" valign="middle"><span class="style7"> <form action="1longlea.php" method="post"></span></td>
</table>
<table width="850" height="240" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#EEEEEE">
<tr>
<th height="38" colspan="4" align="center" bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="200" height="40" align="right"><span class="style7">รายวิชา:</span></td>
<td width="600" align="left"><?
include ("connect_db.php");
$strSQL = "SELECT DISTINCT EVALUATE.EV1.COURSEID,
EVALUATE.EV1.COURSECODE,
EVALUATE.EV1.COURSENAME,
EVALUATE.TQF.PROGRAMID,
EVALUATE.EV1.PROGRAMNAME
FROM
EVALUATE.TQF
Inner Join EVALUATE.EV1 ON EVALUATE.TQF.PROGRAMID = EVALUATE.EV1.PROGRAMID
ORDER BY
EVALUATE.EV1.COURSEID ASC";
$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
?>
<select name="COURSEID" id="COURSEID">
<option value=["COURSEID"]><font size="+2"> --เลือก--</font></option>
<?
while($objResult = oci_fetch_array($objParse,OCI_BOTH))
{
?>
<font size="+2">
<option value="<?=$objResult["COURSEID"];?>"><?=$objResult["COURSECODE"];?>:<?=$objResult["COURSENAME"];?></option>
</font>
<?
}
?>
<?
oci_close($objConnect);
?>
</select></td>
</tr>
</table></th>
</tr>
<tr>
<td height="55" colspan="4" align="center" valign="middle" bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="200" height="40" align="right"><strong><span class="style7">ปีการศึกษา:</span></strong></td>
<td width="600" align="left"><strong>
<select name="ACADYEAR" id="ACADYEAR">
<option value=" ">--เลือก-</option>
<? for($i=2012; $i<=date("Y"); $i++) {?>
<option value="<? echo $i; ?>"> <? echo $i+543; ?></option>
<? }?>
</select>
</strong></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="4" align="center" valign="middle" bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="200" height="40" align="right" valign="middle"><strong><span class="style7">เทอม:</span></strong></td>
<td width="600" align="left"><strong>
<select name="SEMESTER" id="SEMESTER">
<option><font size="+2">--เลือก-</font></option>
<option value="1"><font size="+2">1</font></option>
<option value="2"><font size="+2">2</font></option>
<option value="2"><font size="+2">3</font></option>
</select>
</strong></td>
</tr>
</table></td>
</tr> <?
if($_GET["PROGRAMID"] != "")
{
include ("connect_db.php");
$strSQL = "SELECT EVALUATE.TQF.TQF_ID,
EVALUATE.TQF.CAT_ID,
EVALUATE.TQF.DESCRIPTION,
EVALUATE.TQF.PROGRAMID,
EVALUATE.CATEGORY.CAT_NAME,
AVSREG.PROGRAM.PROGRAMNAME
FROM
EVALUATE.TQF
Inner Join EVALUATE.CATEGORY ON EVALUATE.TQF.CAT_ID = EVALUATE.CATEGORY.CAT_ID
Inner Join AVSREG.PROGRAM ON EVALUATE.TQF.PROGRAMID = AVSREG.PROGRAM.PROGRAMID WHERE (PROGRAMID LIKE '%".$_GET["PROGRAMID"]."%')ORDER BY CAT_ID ASC";
$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
?>
<?php /*?>เกณฑ์ TQF สาขาวิชา <?=$objResult["PROGRAMID"];?><?=$objResult["PROGRAMNAME"];?><?php */?><tr>
<td width="550" align="center" valign="middle" bgcolor="#FFCCFF"><span class="style15">เกณฑ์ TQF</span></td>
<td width="98" align="center" valign="middle" bgcolor="#FFCCFF"><span class="style15">หมวดหมู่</span></td>
<td width="100" align="center" valign="middle" bgcolor="#FFCCFF"><span class="style15">สาขาวิชา</span></td>
<td width="50" align="center" valign="middle" bgcolor="#FFCCFF"><span class="style15">เลือก</span></td>
</tr>
<?
while($objResult = oci_fetch_array($objParse,OCI_BOTH))
{
?>
<tr>
<td height="48" align="left" valign="middle" bgcolor="#EEEEEE"><span class="style10"><span class="style11"><?=$objResult["DESCRIPTION"];?><font color="#EEEEEE">
<?=$objResult["TQF_ID"];?></font><font color="#EEEEEE"></font></span></td>
<td align="left" valign="middle" bgcolor="#EEEEEE"><?=$objResult["CAT_NAME"];?></td>
<td align="left" valign="middle" bgcolor="#EEEEEE"><input type="hidden"=<?=$objResult["PROGRAMID"];?>><?=$objResult["PROGRAMNAME"];?></td>
<td align="center" valign="middle" bgcolor="#EEEEEE"><input type="checkbox" name="TQF_ID[]" value="<?=$objResult["TQF_ID"];?>" /></td>
</tr>
<?
}
?>
</table>
<p align="left"></form>
<table width="134" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td width="132" align="left"><?
oci_close($objConnect);
}
?>
<input type="submit" name="Submit" value=" บันทึก " /></td>
</tr>
</table></form>
</body>
</html>
นี่เป็นโค้ดบันทึกลงฐานค่ะ
Code (PHP)
<!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>
</head>
<body>
<?
include ("connect_db.php");
foreach($_POST[TQF_ID] as $t){
$strSQL = "INSERT INTO LEARNING ";
$strSQL .="(\"LEARNINGID\",\"TQF_ID\",\"ACADYEAR\",\"SEMESTER\",\"COURSEID\",\"PROGRAMID\")";
$strSQL .="VALUES ";
$strSQL .="(S_LEARNING_ID.NEXTVAL,'".$t."','".$_POST["ACADYEAR"]."','".$_POST["SEMESTER"]."','".$_POST["COURSEID"]."','".$_POST["PROGRAMID"]."')";
$objParse = oci_parse($objConnect, $strSQL);
$objExecute = oci_execute($objParse, OCI_DEFAULT)or die(oci_error());
if(isset($_POST["TQF_ID"])){
for($i=0;$i<count($_POST["TQF_ID"]);$i++){
// ???????????? ???????? $i ??????????????????
}
oci_commit($objConnect);
//echo "$t <br>";
}
//echo count($_POST[TQF_ID]);
}
echo "???????????????.";
// echo $Result;
oci_close($objConnect);
?>
</body>
</html>
<?php
foreach($_REQUEST as $key => $value) {
echo $key . "=" . $value . "<BR>";
}
?>
Tag : PHP, Oracle
|
|
|
|
|
|
Date :
2012-04-09 23:18:31 |
By :
comerror |
View :
937 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<input type="hidden"=<?=$objResult["PROGRAMID"];?>>
ดูตัวนี้ด้วยครับ
|
|
|
|
|
Date :
2012-04-10 06:14:16 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|