方法一:

重复的字段设为 主键或唯一键(unique)


方法法二(推荐):

此处要求username账号唯一,不能重复:


insert into `table` (`id`,`username`,`realname`) select NULL,'$username' ,'$realname' from dual where not exists(select * from `table` where `username`='$username');

相关评论(0)
您是不是忘了说点什么?

友情提示:垃圾评论一律封号...

还没有评论,快来抢沙发吧!