我已经创建了一个登录系统。我对 MYSQL 有一些了解,我想修改这么多的代码。
这是代码:
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS Country;
CREATE TABLE Country(
country_code char(2) not null,
country_name varchar(60) not null,
primary key(country_code)
)
CREATE TABLE users(
pk_user int unsigned not null auto_increment,
email varchar(120) not null,
flname varchar(100) not null,
password varchar(64) not null,
country_code char(2) not null,
usr_ip varchar(15),
usr_nmb_logins int(10) unsigned not null default 0,
usr_signup_date timestamp not null default CURRENT_TIMESTAMP,
usr_userid varchar(32),
usr_confirm_hash varchar(255) not null, # for the account confirmation
usr_is_confirmed tinyint(1) not null default 0, # after confirming its set to 1
usr_resetpassword_hash varchar(255) not null, # when the user resets password (forgot password)
usr_is_blocked tinyint(1) not null default 0, # blocked or not
usr_is_admin tinyint(1) not null default 0, # admin or not
foreign key(country_code) references Country(country_code),
unique index(email),
primary key(pk_user)
)
还有大量的insert
s,如下所示:
insert into Country(country_code,country_name) values("n","?");
这是至少一百个相同格式的第一个。
这是PHPMyAdmin
给我的错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE users(
pk_user int unsigned not null auto_increment,
ema' at line 6
但是当我取出那个错误或修复它时,更多的出现并告诉你真相,我不知道该怎么做。