I am trying to delete a member of staff from a table using php using a drop down menu of staff id's he is my code

<!-- deletestaffmember.php -->
<html><body>
<?php
putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin");
$conn = OCILogon("wkagonye","maniki", "shu10g");
$query = "select StaffNo from tblstaff";
$stmt = ociparse($conn, $query);
ociexecute($stmt);
?>
<form action="deletestaffmember.php" method="post">
staffno
<select name="StaffNo">
<option></option>
<?php
while (ocifetchinto($stmt, $row))
{
print "<option>";
print $row[0];
print "</option>";
}
?>
</select>
<input type="Submit" name="Submit" value="Delete Staff member">
</form>

<?php
if ($_POST["StaffNo"]=="")
{
print "Please Select a member of staff using a staff number to Delete";
}
else
{
$staffno =$_POST[StaffNo];

$query = "delete from tblstaff where StaffNo = '$StaffNo' ";
$stmt = ociparse($conn, $query);
ociexecute($stmt);

while (ocifetchinto($stmt, $row))
{
print "$row[0]\t$row[1]";
print "<br>";
}

}
?>

</body></html>

This is the error message i get

Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done before fetch or execute and fetch in /homedir/ilex-s04/dsmith25/public_html/deletestaffmember.php on line 45
any answers

Recommended Answers

All 3 Replies

you should set the value of the

<option>

and it should be equal to $row[0];
somthing like this ...

print "<option value='".$row[0]."'>";
 print $row[0];
 print "</option>";

dosnt work mate tried it i am starting to lose patience with it i still get the same error message

Delete the value through in array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.