Hi guys,
I use below code to connect to Oracle8i DB with PHP
<?php
$conn= ora_plogon("yourlogin@server", "yourpassword") or die;
$cursor = ora_open($conn);
ora_commitoff($conn);
$qsvGetEmployees = "SELECT employee_id_no from employee";
$iStatement = @OCIParse($conn, $qsvGetEmployees);
@OCIExecute($iStatement, OCI_DEFAULT);
// check our query
$arrError = OCIError($iStatement);
if ($arrError['code'])
{
print $arrError['message'];
exit;
}
?>
<table border="1" width="600">
<tr>
<td>ID</td>
<td>FIRST NAME</td>
</tr>
<?php
while (OCIFetchInto($iStatement, &$arrEmployee, OCI_ASSOC+OCI_RETURN_NULLS))
{
?>
<tr>
<td><?= $arrEmployee['EMPLOYEE_ID_NO'] ?></td>
</tr>
<? }?>
</table>
But nothing display.
When I change to below :
$query = "SELECT * FROM [table name]";
ora_parse($cursor, $query) or die; // parse the SQL statement
ora_exec($cursor); // execute the parsed SQL statement
ora_fetch($cursor); // fetch a row of data
Warning: Ora_Fetch failed (ORA-01861: literal does not match format string -- while processing OCI function OFETCH/OFEN)
The above warning message display.
Please help ! Thanks
Larva
I use below code to connect to Oracle8i DB with PHP
<?php
$conn= ora_plogon("yourlogin@server", "yourpassword") or die;
$cursor = ora_open($conn);
ora_commitoff($conn);
$qsvGetEmployees = "SELECT employee_id_no from employee";
$iStatement = @OCIParse($conn, $qsvGetEmployees);
@OCIExecute($iStatement, OCI_DEFAULT);
// check our query
$arrError = OCIError($iStatement);
if ($arrError['code'])
{
print $arrError['message'];
exit;
}
?>
<table border="1" width="600">
<tr>
<td>ID</td>
<td>FIRST NAME</td>
</tr>
<?php
while (OCIFetchInto($iStatement, &$arrEmployee, OCI_ASSOC+OCI_RETURN_NULLS))
{
?>
<tr>
<td><?= $arrEmployee['EMPLOYEE_ID_NO'] ?></td>
</tr>
<? }?>
</table>
But nothing display.
When I change to below :
$query = "SELECT * FROM [table name]";
ora_parse($cursor, $query) or die; // parse the SQL statement
ora_exec($cursor); // execute the parsed SQL statement
ora_fetch($cursor); // fetch a row of data
Warning: Ora_Fetch failed (ORA-01861: literal does not match format string -- while processing OCI function OFETCH/OFEN)
The above warning message display.
Please help ! Thanks
Larva