简体   繁体   English

xampp MySQL的INSERT查询不起作用

[英]INSERT query of xampp MySQL doesn't work

This php insert query is not working in MYSQL xampp. 此php插入查询在MYSQL xampp中不起作用。 I couldn't find any error 我找不到任何错误

QUERY: 查询:

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt )
VALUES ( '$username', '$password', '$email', '$salt' )";

you are missing $fname, $lname in query also use NULL for id if auto incremented 您缺少$ fname,如果自动递增,查询中的$ lname也将NULL用作id

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt )
VALUES (NULL, '$username', '$fname', '$lname', '$password', '$email', '$salt' )";

you are passing wrong number of column names.your correct query should look like this: 您传递的列名数量错误。正确的查询应如下所示:

$query = "INSERT INTO member (username,password,email,salt )
VALUES ( '$username', '$password', '$email', '$salt' )";

You are not inserting values to all the columns specified in the query. 您没有将值插入查询中指定的所有列。

In your query 在您的查询中

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt )
VALUES ( '$username', '$password', '$email', '$salt' )";

You are specifying 7 columns and only 4 values .So either add more values or remove unnecessary columns specified in the query like 您要指定7列和仅4个值。因此,可以添加更多值或删除查询中指定的不必要列,例如

$query = "INSERT INTO member (username, password,email, salt )
VALUES ( '$username', '$password', '$email', '$salt' )";

OR 要么

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt )
VALUES ('$id', '$username','$fname','$lname','$email', '$password', '$salt' )";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM