internetguy
Technical User
I have a database with users, but I want to make it so that an administrator can delete any users they see fit. The code seems correct and no error occurs but the user is still in the database. Here is my code.
<?php
$name = $_POST['name'];
if (!$name)
{
echo "You did not input a user name, please try again\n";
echo "<p><a href='user_del.php'>+Retry</a><br>\n";
echo "<a href='../main.php'>+Main Page</a></p>\n";
}
else
{
$db = mysql_connect('localhost','root');
mysql_select_db('users');
$query = "DELETE * FROM info WHERE name='".$name."'" or die(mysql_error());
echo "User has been deleted from the database\n";
echo "<p><a href='user_del.php'>+Delete Another User?</a><br>\n";
echo "<a href='../main.php'>+Main Page</a></p>\n";
}
?>
<?php
$name = $_POST['name'];
if (!$name)
{
echo "You did not input a user name, please try again\n";
echo "<p><a href='user_del.php'>+Retry</a><br>\n";
echo "<a href='../main.php'>+Main Page</a></p>\n";
}
else
{
$db = mysql_connect('localhost','root');
mysql_select_db('users');
$query = "DELETE * FROM info WHERE name='".$name."'" or die(mysql_error());
echo "User has been deleted from the database\n";
echo "<p><a href='user_del.php'>+Delete Another User?</a><br>\n";
echo "<a href='../main.php'>+Main Page</a></p>\n";
}
?>