检查用户名... [英] Checking for username...

查看:92
本文介绍了检查用户名...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如果在
注册一个新的user_name进行制作时,如何在列user_name上签入一个名为''Users''的mySQL表确定该列中已经存在新的''user_name''




TIA

Hi all,

How do I check in a mySQL table called ''Users'' on column user_name when
registering a new user_name to make sure the new ''user_name'' does not
already exist in that column?

TIA

推荐答案

>当
注册新的user_name以确保新的''user_name''时,如何在列user_name上检入名为''Users'的mySQL表?该列中是否已经存在?
registering a new user_name to make sure the new ''user_name'' does not
already exist in that column?




一个合适的方法是插入一个带有用户名的行,它将是

如果用户名正在使用中,则会失败,因为您在user_name列上有唯一索引




Gordon L. Burditt



An appropriate way is to insert a row with the username, and it will
fail if the username is in use because of the unique index you have
on the user_name column.

Gordon L. Burditt


*** Domestos写道/escribió(星期一,2005年6月13日20:50:51 GMT):
*** Domestos wrote/escribió (Mon, 13 Jun 2005 20:50:51 GMT):
如何签入名为''Users的mySQL表在列上user_name在注册新的user_name时确保新的''user_name''不存在于该列中?
How do I check in a mySQL table called ''Users'' on column user_name when
registering a new user_name to make sure the new ''user_name'' does not
already exist in that column?




我通常做这样的事情:


SELECT id FROM users WHERE username =''john''


如果返回零行,则用户名是可用。


-

- álvaroG。Vicario - 西班牙布尔戈斯

- http://bits.demogracia.com - Mi sitiosobreprogramaciónweb

- Don 请将您的问题通过电子邮件发送给我。

-



I normally do something like this:

SELECT id FROM users WHERE username=''john''

If zero rows are returned, the username is available.

--
-- álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don''t e-mail me your questions, post them to the group
--


Alvaro G Vicario D?D ???Dμ ??:
Alvaro G Vicario D?D???Dμ??:
*** Domestos写道/ escribi?3(星期一,2005年6月13日20:50:51 GMT):
*** Domestos wrote/escribi?3 (Mon, 13 Jun 2005 20:50:51 GMT):
我该如何检查在
注册新的user_name以确保新的''user_name时,在列user_name上名为''Users''的mySQL表中''不存在于该列中?
How do I check in a mySQL table called ''Users'' on column user_name when
registering a new user_name to make sure the new ''user_name'' does not
already exist in that column?



我通常会这样做:

SELECT id FROM users WHERE username ='' john''

如果返回零行,则用户名可用。


I normally do something like this:

SELECT id FROM users WHERE username=''john''

If zero rows are returned, the username is available.



我想最好使用not =''john''但是喜欢''john '',因为区分大小写


I guess better use not =''john'' but like ''john'', because of case-sensitive


这篇关于检查用户名...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆