php verify name exists in mysql

藏色散人
Release: 2023-02-25 18:34:01
Original
2811 people have browsed it

php verify name exists in mysql

#How does php verify whether the name exists in mysql?

PHP connects to MySQL to query whether the user name exists (login verification)

The code is as follows:

query("select username from user where username ='{$username}' and password = '{$password}'"); //查询数据库中的用户名和密码 并返回集合 $row = mysqli_fetch_assoc($sql); //取其中一行 if ($row > 0) { //判断是否存在 echo "欢迎'{$username}'再次登录"; } else { echo ",您还没有账号,请先进行注册!!!"; header("location:register.html"); //跳转至注册页面 } ?>
Copy after login

For more PHP knowledge, please visitPHP中文网!

The above is the detailed content of php verify name exists in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!