1

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";
?>
4

2 回答 2

5

MySQL 删除语句是:

从 table_name 中删除 some_column = some_value;

看看这里:http ://www.w3schools.com/php/php_mysql_delete.asp

于 2012-12-11T01:03:14.740 回答
1

从 some_table 中删除 some_value=X;

于 2012-12-11T01:02:56.130 回答