如何检查SQL数据库中是否存在特定值

问题描述:

嗨 我想对用户名使用客户端验证,即当数据库中已经存在用户名时,它将向我发送消息.

Hi I want to use client side validation on username i.e. it will give message to me when username already exists in database.

使用传统的Ajax,即 XMLHttpRequest .
步骤:
1.根据文本框的用户名onchange/onblurr,将带有用户名文本的xmlhttprequest发送到服务器端.
2.在服务器端,与数据库检查用户名是否存在
3.根据结果,如果用户名已经存在,则发送回响应
4.根据客户端的响应,显示相应的消息.

试试吧!

如果需要,只需使用Google for XMLHttprequest,您将在同一文章上获得很多文章.
Use traditional Ajax, i.e. XMLHttpRequest for it.
Steps:
1. Based on username onchange/onblurr of the textbox, send a xmlhttprequest to server side with the username text.
2. On server side, check with DB about the username existence
3. Based on the result, send back response if the username already exizts
4. Based on response on client side, show the appropriate message.

Try!

If needed, just Google for XMLHttprequest, and you will get lots of articles on the same.