我在 html 中有我的注册表单所有设置和工作,它第一次运行并在 mysql 表中插入一行,但我不能再插入任何行。
我的PHP是: -
include "config.php";
$gamerid = $_POST['gamerid_create'];
$email = $_POST['email_create'];
$password = md5($_POST['password_create']);
$country = $_POST ['country_create'];
echo "<pre>";
print_r($_POST);
echo "</pre>";
$insert = "insert into users (gamerid,email,password,country) values('$gamerid','$email','$password','$country')";
mysql_query($insert);
现在,当我在 mysql 中创建表时,我使用了以下代码:-
CREATE TABLE users
(
id INT primary key NOT NULL AUTO_INCREMENT,
gamerid varchar (255) NOT NULL,
email varchar (255) NOT NULL,
password varchar (255) NOT NULL,
country varchar (255) NOT NULL
)
为什么不插入更多行?
我的html如下:
<form id = "signup_form" method = "POST" action = "http://localhost:8080/quizicle/pages/register.php">
<table id = "signup_form_table" border = "0" class = "signup_table_body">
<tr class = "signup_form_tr_label">
<td class = "signup_form_td"><label for "gamerid" class = "signup_form_label">Create a Gamer ID:</label></td>
<td class = "signup_form_td"><label for "email" class = "signup_form_label">Your Email:</label></td>
<td class = "signup_form_td"><label for "password" class = "signup_form_label">Password:</label></td>
<td class = "signup_form_td"><label for "country" class = "signup_form_label">Country:</label></td>
<td class = "signup_form_td"></td>
</tr>
<tr class = "signup_form_tr">
<td class = "signup_form_td"><input type = "text" name = "gamerid_create" id = "gamerid_create" maxlength="50" class = "signup_form_input"/></td>
<td class = "signup_form_td"><input type = "text" name = "email_create" id = "email_create" maxlength="50" class = "signup_form_input"/></td>
<td class = "signup_form_td"><input type = "password" name = "password_create" id = "password_create" maxlength="50" class = "signup_form_input"/></td>
<td class = "signup_form_td">
<select name = "country_create"> <option>Please select a country</option>
<option>United Kingdom</option>
</select>
</td>
<td class = "signup_form_td"><input type = "submit" value = "Sign me up!" id = "btn_register" value = "register" class = "signup_form_submit_btn"/></td>
</tr>
</table>
</form>