Ben php kullanarak mysql bir kaydı silmek için çalışıyorum. Önce bir silme onay olacak ki benim kod eklemek için ne var. Benim geçerli kod, otomatik olarak girilen pNUM karşılık kaydı siler çünkü.
<html>
<style>
input { font-size: 16px;}
</style>
<?php include('header.php'); ?>
<div id="main_content">
</div>
<?php include('footer.php'); ?>
<head>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="DeletebyPnumIn.php" method="post">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="9" style="background:#9ACD32; color:white; border:white 1px solid; text-align: center"><strong><font size="3">Delete In-patient</strong></td>
</tr>
<td><font size="3">Patient #:</td>
<td></td>
<td><input type="text" name="pnum" value="" maxlength="15" /><br/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Delete" /></td>
</form>
</tr>
</table>
<body>
</body>
</html>
İşte formu eylemdir:
<html>
<style>
input { font-size: 16px;}
</style>
<?php include('header.php'); ?>
<div id="main_content">
</div>
<?php include('footer.php'); ?>
<head>
<?php
$con = mysql_connect("localhost","root","nitoryolai123$%^");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("hospital", $con);
mysql_query("DELETE FROM t2 WHERE PNUM='{$_POST["pnum"]}'") ;
mysql_close($con);
echo "<script>alert('Record successfully deleted!')</script>";
?>
Lütfen yardım edin.