[SOLVED] delete user query
Posted: Mon Aug 02, 2004 8:14 pm
What is wrong with this code.
When I click the DELETE button, I get the message RECORD SUCCESSFULLY REMOVED but the data is still in the database.
Code: Select all
<?php
<?
include("database.php");
include("login.php");
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', '');
define('DB', 'db1');
$u_username = $_POST['u_username'];
?>
<form action = "" method = "post">
<center>Are You sure you want to delete <? echo $u_username; ?> record from database?
<br><br>
<input type = "submit" value = "DELETE" name = "del">
</form>
<form action = "viewuser.php" method = "post">
<input type = "submit" value = "CANCEL" name = "can">
</form>
<?
if($_POST['del'])
{
global $conn;
$query = "DELETE FROM employee WHERE username = '$u_username'";
mysql_query($query, $conn);
?>
<font color="#671247" size="3" face="Verdana, Arial, Helvetica, sans-serif">
<br><br><br><center><h3>RECORD SUCCESSFULLY REMOVED.<h3></center>
<form action="viewuser.php" method="post">
<center><input type="submit" value="BACK" name="back"></center></form>
<?}?>
?>