ive just followed a tutorial where if a user chooses to delete there account and after i click delete account i get the following message Unable to delete user account!
can someone check this out for me please
delete.php
<?php
include ('dbconnect.php');
if (isset($_GET['del'])) {
$user_id = $_GET['del'];
$delete = "DELETE FROM `users` WHERE `user_id`='$user_id'";
$res = mysqli_query($MySQLi_CON,$delete) or die('Unable to delete user account!');
header('Location:index.php');
}
?>
Link to delete.php
<a href="delete.php?del=$row['user_id']">Delete Account</a>
and heres database table
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(5) NOT NULL,
`user_name` varchar(25) NOT NULL,
`user_email` varchar(35) NOT NULL,
`user_pass` varchar(255) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
any help would be much appreicated x