MySQLINSERT
命令的反义词是什么?
我想知道如何在没有管理员的情况下从表中删除用户。我到处搜索,但根本找不到。
这是我的 PHP 文件:
<?php
$username = $_POST["username"];
$password = $_POST["password"];
$passcheck = $_POST["passcheck"];
$email = $_POST["email"];
if ( $username && $password && $passcheck && $email ) {
} else
echo "Please enter all fields";
?>
...
<form action="register.php" method="post">
<input type="text" name="username"><br>
<input type="password" name="password"><br>
<input type="password" name="passcheck"><br>
<input type="text" name="email"><br>
<input type="submit" value="Register">
</form>
<?php
$username = $_POST["username"];
$password = $_POST["password"];
$passcheck = $_POST["passcheck"];
$email = $_POST["email"];
if ( $username && $password && $passcheck && $email ) {
$connect = mysql_connect( "localhost", "root", "root" ) or die("Couldn't connect!");
mysql_select_db("login") or die("Couldn't find database!");
$query = mysql_query( "SELECT * FROM users WHERE username='$username'" );
$numrows = mysql_num_rows( $query );
if ( $numrows != 0 ) {
echo "Username taken";
} else
if ( $password == $passcheck ) {
mysql_query("INSERT INTO users (username, password, email)
VALUES ('$username','$password','$email')");
} else
echo "Passwords don't match";
} else
echo "Please enter all fields";
?>