Hi, im trying to run the following code, but keep getting the following error:
Warning: oci_execute() [function.oci-execute]: OCIStmtExecute: ORA-00903: invalid table name in /study/comp/c3035544/webpages/Bronte/_admin/mark.php on line 19.
The table name is correct, I know its something to do with the following section, but need help in resolving the issue.
$stmt = oci_parse($connection, $query);
$result = oci_execute($stmt);
<?php
// set server access variables
require('_includes/connect.inc'); //Connection details
// if id provided, then delete that record
if (isset($_GET['COTTAGE_NAME'])) {
// create query to delete record
$query = "DELETE * FROM COTTAGE WHERE COTTAGE_NAME = ".$_GET['COTTAGE_NAME'];
//Parsing with some error reporting
$stmt = oci_parse($connection, $query);
$result = oci_execute($stmt);
}
// create query
$query = "SELECT COTTAGE_NAME, DESCRIPTION, OCCUPANCY, GRADE FROM COTTAGE";
//Parsing with some error reporting
$stmt = oci_parse($connection, $query);
$result = oci_execute($stmt);
print "<table cellpadding= 3 border = 1";
print " <tr><th>name</th><th>description</th><th>Occupancy</th><th>Grade</th><th>delete</th></tr>";
while(oci_fetch($stmt))
{
print " <tr>";
print " <td>" . stripslashes(oci_result($stmt, "COTTAGE_NAME")) . "</td>";
print " <td>" . stripslashes(oci_result($stmt, "DESCRIPTION")) . "</td>";
print " <td>" . stripslashes(oci_result($stmt, "OCCUPANCY")) . "</td>";
print " <td>" . stripslashes(oci_result($stmt, "GRADE")) . "</td>";
print " <td><a href=".$_SERVER['PHP_SELF']."?COTTAGE_NAME=". stripslashes(oci_result($stmt, "COTTAGE_NAME")) .">Delete</a></td>";
print " </tr>";
}
print "</table>";
//Free the resource
OCIFreeStatement($stmt);
//Clost the connection
ocilogoff($connection );
?>
<a href="cottage.php">Add Cottage</a>
</body>
</html>
<? footer();?>
Thanks in advance