|
|
|
(Oracle) Undefined index : โดยใช้ xampp เป็น localhost |
|
|
|
|
|
|
|
มันขึ้น Undefined index ผมแก้หลายครั้งแล้ว มันก็ยังขึ้น ขอถามผู้รู้จริงๆ ช่วยดูโค้ดให้ผมหน่อยมันผิดตรงไหน โดยเชื่อมต่อ Oracle
TST.php
<html>
<head>
<title>TST</title>
</head>
<body>
<?php
$objConnect = oci_connect("chaprayom", "1234", '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME =) (SID = chaprayom)))');
if($objConnect)
{
echo "Oracle Server Connected";
}
else
{
echo "Can not connect to Oracle Server";
}
$strSQL = "SELECT * FROM EMPLOYEE";
$objParse = oci_parse($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
?>
<table width="800" border="1">
<tr>
<th width="91"> <div align="center">ID_EMPLOYEE </div></th>
<th width="98"> <div align="center">NAME_TITLE</div></th>
<th width="198"> <div align="center">FNAME</div></th>
<th width="97"> <div align="center">LNAME</div></th>
<th width="97"> <div align="center">DATE</div></th>
<th width="97"> <div align="center">ADDRESS</div></th>
<th width="97"> <div align="center">Delete</div></th>
<th width="97"> <div align="center">Edit</div></th>
</tr>
<?php
while($objResult = oci_fetch_array($objParse,OCI_BOTH))
{
?>
<tr>
<td><?php echo $objResult["ID_EMPLOYEE"];?></td>
<td><?php echo $objResult["NAME_TITLE"];?></td>
<td><?php echo $objResult["FNAME"];?></td>
<td><?php echo $objResult["LNAME"];?></td>
<td><?php echo $objResult["B_DATE"];?></td>
<td><?php echo $objResult["ADDRESS"];?></td>
<td align="center"><a href="phpOracleDeleteRecord.php?EMP_ID=<?php echo $objResult["ID_EMPLOYEE"];?>">Delete</a></td>
<td align="center"><a href="phpOracleEditRecordForm.php?EMP_ID=<?php echo $objResult["ID_EMPLOYEE"];?>">Edit</a></td>
</tr>
<?php
}
?>
</table>
<br><a href="phpOracleAddForm.php">เพื่มข้อมูล</a>
<?php
oci_close($objConnect);
?>
</body>
</html>
phpOracleEditRecordForm.php
<html>
<head>
<title>OracleEditRecordForm</title>
</head>
<body>
<form action="phpOracleEditRecordSave.php?EMP_ID=<?php echo $_GET["EMP_ID"];?>" name="frmEdit" method="post">
<?php
$objConnect = oci_connect("chaprayom", "1234", '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME =) (SID = chaprayom)))');
$strSQL = "SELECT * FROM EMPLOYEE WHERE ID_EMPLOYEE = '".$_GET["EMP_ID"]."' ";
$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
$objResult = oci_fetch_array($objParse);
if(!$objResult)
{
echo "Not found ID_EMPLOYEE=".$_GET["EMPID"];
}
else
{
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">ID_EMPLOYEE </div></th>
<th width="98"> <div align="center">NAME_TITLE</div></th>
<th width="198"> <div align="center">FNAME</div></th>
<th width="97"> <div align="center">LNAME </div></th>
<th width="91"> <div align="center">DATE</div></th>
<th width="91"> <div align="center">ADDRESS </div></th>
</tr>
<tr>
<td><input type="text" name="ID_EMPLOYEE " size="20" value="<?php echo $objResult["ID_EMPLOYEE"];?>"></td>
<td><input type="text" name="NAME_TITLE" size="20" value="<?php echo $objResult["NAME_TITLE"];?>"></td>
<td><input type="text" name="FNAME" size="20" value="<?php echo $objResult["FNAME"];?>"></td>
<td><input type="text" name="LNAME" size="20" value="<?php echo $objResult["LNAME"];?>"></td>
<td><input type="text" name="DATE" size="20" value="<?php echo $objResult["B_DATE"];?>"></td>
<td><input type="text" name="ADDRESS" size="20" value="<?php echo $objResult["ADDRESS"];?>"></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<?php
}
oci_close($objConnect);
?>
</form>
</body>
</html>
SCREENSHOT
Tag : Oracle, XAMPP
|
ประวัติการแก้ไข 2018-05-28 00:22:47
|
|
|
|
|
Date :
2018-05-28 00:12:46 |
By :
arelnwna |
View :
733 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตรวจสอบ ฟีลด์ด้วยตา
บันทัด 36.
Code (PHP)
while($objResult = oci_fetch_array($objParse,OCI_BOTH))
{
vardump($objResult); exit;
|
|
|
|
|
Date :
2018-05-28 07:09:41 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ไขปัญหา Notice: Undefined index บน PHP แสดง Error/Message นี้เมื่อ
|
|
|
|
|
Date :
2018-05-28 09:27:54 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|