PHP ajax registration verification code exists_PHP tutorial

WBOY
Release: 2016-07-13 10:57:43
Original
1160 people have browsed it

php ajax registration verification code exists for username This is a registration program. When the user enters the user name, it will automatically go to the database to check whether the user name that the user wants to register has been registered. If so, it will return a prompt, otherwise it will prompt that the user can register.

php tutorial ajax registration verification code for username existence
This is a registration program. When the user enters the user name, it will automatically go to the database tutorial to check whether the user name that the user wants to register has been registered. If so, it will return a prompt, otherwise it will prompt that the user can register.
conn.php file

















Username:




$q=$_get["q"];
$q = urldecode($q);

if (strlen($q) > 0)
{
$conn = @mysql tutorial_connect("localhost","root","1010") or die ("mysql connection error");
mysql_select_db("xin",$conn);
mysql_query("set names 'utf8'");

$sql = "select username from message where username = '$q'";
$query = mysql_query($sql);
@$row = mysql_fetch_array($query);

if(!empty($row['username']))
{
$response = "Already registered!";
}else
{
$response = "Congratulations! You can register!";
}

echo $response;
}

?>

Database
drop database if exists `xin`;
create database `xin` /*!40100 default character set utf8 */;
use `xin`;


create table `message` (
`id` int(11) not null auto_increment,
`username` varchar(20) default null,
primary key (`id`)
) engine=innodb auto_increment=2 default charset=utf8;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632060.htmlTechArticlephp ajax registration verification code to verify whether the user name exists. This is the registration program. When the user completes entering the user name, It will automatically go to the database to check whether the user name to be registered has been registered...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template