พอดีเขียน report ให้กับพี่คนหนึ่งคะ แล้วข้อมูลมันก็สามรถเพิ่มได้ ขึ้น save done ตลอด แต่พอเปลี่ยน echo จาก save done เป็น โชว์ form ละคะ มันไม่เข้าเลย ย้อนไปเป็นเหมือนเดิมตอน echo save done ก็ไม่หายแล้ว แก้ไม่ออกเลยคะ
ปล1. หนูเป็นแค่เด็กฝึกงานนะคะ อย่าบ่นหนูเลย
ปล2. หนูไม่รู้จะเอา code ขึ้นยังไงให้มันดูดี ยังเล่น พันทิปไม่ค่อยเป็น ขออภัยด้วยคะ
ส่วน code คะ
<?php
if ($action=="Add"){
if ($conn = OCILogon($dbuser, $dbpassword, $db)){
$sql = " INSERT INTO TBL_CMD_EVENT
(EVENT_TITLE,EVENT_DATE,ROOT_CAUSE,EVENT_TYPE,PLAN_UNPLAN_EVENT,INCIDENT,
PRODUCT_IMPACT,CALL_CENTER_IMPACT,SUB_IMPACT,SUB_TYPE,IMPACT_TO_CUSTOMER,IMPACT_TO_CM,CCQA_FLAG,
START_TIME,END_TIME,
OWNER,ACTION,SLA,REFER_TT_UCR,INTERVAL_IMPACT,SR,IVR)
VALUES ('".$txtEVENT_TITLE."','".$datefrom."', '".$ROOT_CAUSE."', '".$EVENT_TYPE."','".$PLAN_UNPLAN_EVENT."', '".$txtINCIDENT."',
'".$PRODUCT_IMPACT."','".$CALL_CENTER_IMPACT."', '".$txtSUB_IMPACT."','".$SUB_TYPE."','".$txtIMPACT_TO_CUSTOMER."', '".$txtIMPACT_TO_CM."','".$CCQA_FLAG."',
'".$datefrom2."', '".$dateto."',
'".$txtOWNER."','".$txtACTION."','".$datefrom3."','".$txtREFER_TT_UCR."', '".$txtINTERVAL_IMPACT."','".$txtSR."','".$txtIVR."') ";
$objQuery = ociparse($conn, $sql);
if($objQuery)
{
echo "<?php
if ($action=='Load'){
if ($conn = OCILogon($dbuser, $dbpassword, $db))
{
$EVENT = 'SELECT EVENT_TYPE,MAX_QUEUE,CALL_VOL,ABN,SL
FROM TBL_CMD_EVENT
WHERE EVENT_DATE = '".$dateFrom."';
$UEVENT = ociparse($conn, $EVENT);
$i = 0;
ociexecute($UEVENT);
while (ocifetch($UEVENT))
{
$EVENT_TYPE = ociresult($UEVENT, 'EVENT_TYPE');
$EVENT_TYPE_arr[$i] = ociresult($UEVENT, 'EVENT_TYPE');
$MAX_QUEUE = ociresult($UEVENT, 'MAX_QUEUE');
$MAX_QUEUE_arr[$i] = ociresult($UEVENT, 'MAX_QUEUE');
$CALL_VOL = ociresult($UEVENT, 'CALL_VOL');
$CALL_VOL_arr[$i] = ociresult($UEVENT, 'CALL_VOL');
$ABN = ociresult($UEVENT, 'ABN');
$ABN_arr[$i] = ociresult($UEVENT, 'ABN');
$SL = ociresult($UEVENT, 'SL');
$SL_arr[$i] = ociresult($UEVENT, 'SL');
$i++;
}
}else{
$err = OCIError();
echo 'Oracle Connect Error' . $err[text];
}
}
?>
<div class='container-fluid'>
<div class='panel panel-default'>
<div class='panel-heading'>
<h3>DATA_OUTPUT</h3>
</div>
<form method='post' name='form2' id='form2'>
<table width='1087' height='125' border='0' align='center'>
<tr>
<td colspan='6' align='center' bgcolor='#666666'>
<span style='color: #FFF;'>Data <?= $dateFrom ?> </span><span style='color: #FFF; font-size:14px;'></span></td>
</tr>
<tr>
<td width='134' align='center' bgcolor='#CCCCCC'>NO.</td>
<td width='326' align='center' bgcolor='#CCCCCC'>EVENT_TYPE</td>
<td width='108' align='center' bgcolor='#CCCCCC'>MAX_QUEUE</td>
<td width='108' align='center' bgcolor='#CCCCCC'>CALL_VOL</td>
<td width='108' align='center' bgcolor='#CCCCCC'>ABN</td>
<td width='108' align='center' bgcolor='#CCCCCC'>SL</td>
</tr>
<? $x=0;
for($j=0;$j<$i;$j++){
$x++;
?>
<tr>
<td align='center'><?=$x?></td>
<td align='center'><?=$EVENT_TYPE_arr[$j]?></td>
<td align='center'><?=$MAX_QUEUE_arr[$j]?></td>
<td align='center'><?=$CALL_VOL_arr[$j]?></td>
<td align='center'><?=$ABN_arr[$j]?></td>
<td align='center'><?=$SL_arr[$j]?></td>
<?
}
echo $x;
?>
</table>
<input align='center' type='submit' name='action' value='Load' />
</form>";
}else{
echo "Error Save [".$sql."]";
if(ociexecute($event)){
$txtEVENT_TITLE =$_POST["EVENT_TITLE"];
$datefrom =$_POST["EVENT_DATE"];
$ROOT_CAUSE =$_POST["ROOT_CAUSE"];
$EVENT_TYPE =$_POST["EVENT_TYPE"];
$PLAN_UNPLAN_EVENT =$_POST["PLAN_UNPLAN_EVENT"];
$txtINCIDENT =$_POST["INCIDENT"];
$PRODUCT_IMPACT =$_POST["PRODUCT_IMPACT"];
$CALL_CENTER_IMPACT =$_POST["CALL_CENTER_IMPACT"];
$txtSUB_IMPACT =$_POST["SUB_IMPACT"];
$SUB_TYPE =$_POST["SUB_TYPE"];
$txtIMPACT_TO_CUSTOMER =$_POST["IMPACT_TO_CUSTOMER"];
$txtIMPACT_TO_CM =$_POST["IMPACT_TO_CM"];
$CCQA_FLAG =$_POST["CCQA_FLAG"];
$dateform2 =$_POST["START_TIME"];
$dateto =$_POST["END_TIME"];
$txtOWNER =$_POST["OWNER"];
$txtACTION =$_POST["ACTION"];
$datefrom3 =$_POST["SLA"];
$txtREFER_TT_UCR =$_POST["REFER_TT_UCR"];
$txtINTERVAL_IMPACT =$_POST["INTERVAL_IMPACT"];
$txtSR =$_POST["SR"];
$txtIVR =$_POST["IVR"];
}
}
}
}
?>
insert data ได้คะ แต่ข้อมูลไม่เข้าฐานข้อมูล:(
ปล1. หนูเป็นแค่เด็กฝึกงานนะคะ อย่าบ่นหนูเลย
ปล2. หนูไม่รู้จะเอา code ขึ้นยังไงให้มันดูดี ยังเล่น พันทิปไม่ค่อยเป็น ขออภัยด้วยคะ
ส่วน code คะ
<?php
if ($action=="Add"){
if ($conn = OCILogon($dbuser, $dbpassword, $db)){
$sql = " INSERT INTO TBL_CMD_EVENT
(EVENT_TITLE,EVENT_DATE,ROOT_CAUSE,EVENT_TYPE,PLAN_UNPLAN_EVENT,INCIDENT,
PRODUCT_IMPACT,CALL_CENTER_IMPACT,SUB_IMPACT,SUB_TYPE,IMPACT_TO_CUSTOMER,IMPACT_TO_CM,CCQA_FLAG,
START_TIME,END_TIME,
OWNER,ACTION,SLA,REFER_TT_UCR,INTERVAL_IMPACT,SR,IVR)
VALUES ('".$txtEVENT_TITLE."','".$datefrom."', '".$ROOT_CAUSE."', '".$EVENT_TYPE."','".$PLAN_UNPLAN_EVENT."', '".$txtINCIDENT."',
'".$PRODUCT_IMPACT."','".$CALL_CENTER_IMPACT."', '".$txtSUB_IMPACT."','".$SUB_TYPE."','".$txtIMPACT_TO_CUSTOMER."', '".$txtIMPACT_TO_CM."','".$CCQA_FLAG."',
'".$datefrom2."', '".$dateto."',
'".$txtOWNER."','".$txtACTION."','".$datefrom3."','".$txtREFER_TT_UCR."', '".$txtINTERVAL_IMPACT."','".$txtSR."','".$txtIVR."') ";
$objQuery = ociparse($conn, $sql);
if($objQuery)
{
echo "<?php
if ($action=='Load'){
if ($conn = OCILogon($dbuser, $dbpassword, $db))
{
$EVENT = 'SELECT EVENT_TYPE,MAX_QUEUE,CALL_VOL,ABN,SL
FROM TBL_CMD_EVENT
WHERE EVENT_DATE = '".$dateFrom."';
$UEVENT = ociparse($conn, $EVENT);
$i = 0;
ociexecute($UEVENT);
while (ocifetch($UEVENT))
{
$EVENT_TYPE = ociresult($UEVENT, 'EVENT_TYPE');
$EVENT_TYPE_arr[$i] = ociresult($UEVENT, 'EVENT_TYPE');
$MAX_QUEUE = ociresult($UEVENT, 'MAX_QUEUE');
$MAX_QUEUE_arr[$i] = ociresult($UEVENT, 'MAX_QUEUE');
$CALL_VOL = ociresult($UEVENT, 'CALL_VOL');
$CALL_VOL_arr[$i] = ociresult($UEVENT, 'CALL_VOL');
$ABN = ociresult($UEVENT, 'ABN');
$ABN_arr[$i] = ociresult($UEVENT, 'ABN');
$SL = ociresult($UEVENT, 'SL');
$SL_arr[$i] = ociresult($UEVENT, 'SL');
$i++;
}
}else{
$err = OCIError();
echo 'Oracle Connect Error' . $err[text];
}
}
?>
<div class='container-fluid'>
<div class='panel panel-default'>
<div class='panel-heading'>
<h3>DATA_OUTPUT</h3>
</div>
<form method='post' name='form2' id='form2'>
<table width='1087' height='125' border='0' align='center'>
<tr>
<td colspan='6' align='center' bgcolor='#666666'>
<span style='color: #FFF;'>Data <?= $dateFrom ?> </span><span style='color: #FFF; font-size:14px;'></span></td>
</tr>
<tr>
<td width='134' align='center' bgcolor='#CCCCCC'>NO.</td>
<td width='326' align='center' bgcolor='#CCCCCC'>EVENT_TYPE</td>
<td width='108' align='center' bgcolor='#CCCCCC'>MAX_QUEUE</td>
<td width='108' align='center' bgcolor='#CCCCCC'>CALL_VOL</td>
<td width='108' align='center' bgcolor='#CCCCCC'>ABN</td>
<td width='108' align='center' bgcolor='#CCCCCC'>SL</td>
</tr>
<? $x=0;
for($j=0;$j<$i;$j++){
$x++;
?>
<tr>
<td align='center'><?=$x?></td>
<td align='center'><?=$EVENT_TYPE_arr[$j]?></td>
<td align='center'><?=$MAX_QUEUE_arr[$j]?></td>
<td align='center'><?=$CALL_VOL_arr[$j]?></td>
<td align='center'><?=$ABN_arr[$j]?></td>
<td align='center'><?=$SL_arr[$j]?></td>
<?
}
echo $x;
?>
</table>
<input align='center' type='submit' name='action' value='Load' />
</form>";
}else{
echo "Error Save [".$sql."]";
if(ociexecute($event)){
$txtEVENT_TITLE =$_POST["EVENT_TITLE"];
$datefrom =$_POST["EVENT_DATE"];
$ROOT_CAUSE =$_POST["ROOT_CAUSE"];
$EVENT_TYPE =$_POST["EVENT_TYPE"];
$PLAN_UNPLAN_EVENT =$_POST["PLAN_UNPLAN_EVENT"];
$txtINCIDENT =$_POST["INCIDENT"];
$PRODUCT_IMPACT =$_POST["PRODUCT_IMPACT"];
$CALL_CENTER_IMPACT =$_POST["CALL_CENTER_IMPACT"];
$txtSUB_IMPACT =$_POST["SUB_IMPACT"];
$SUB_TYPE =$_POST["SUB_TYPE"];
$txtIMPACT_TO_CUSTOMER =$_POST["IMPACT_TO_CUSTOMER"];
$txtIMPACT_TO_CM =$_POST["IMPACT_TO_CM"];
$CCQA_FLAG =$_POST["CCQA_FLAG"];
$dateform2 =$_POST["START_TIME"];
$dateto =$_POST["END_TIME"];
$txtOWNER =$_POST["OWNER"];
$txtACTION =$_POST["ACTION"];
$datefrom3 =$_POST["SLA"];
$txtREFER_TT_UCR =$_POST["REFER_TT_UCR"];
$txtINTERVAL_IMPACT =$_POST["INTERVAL_IMPACT"];
$txtSR =$_POST["SR"];
$txtIVR =$_POST["IVR"];
}
}
}
}
?>