php - 如何判断用户名是否已在数据库中使用

标签 php mysql authentication

如何判断数据库中的用户名是否已被 php 用于注册页面?

最佳答案

类似于:

$sql = 'SELECT * FROM USERS where user_name = "'.$_GET['username'].'"';
$res = mysql_query($sql);
if($res && mysql_num_rows($res)>0){
  echo 'taken';
} else {
  echo 'free';
}

关于php - 如何判断用户名是否已在数据库中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6614724/

相关文章:

php - mysql查询+sprintf=注入(inject)?

php - 非动态数据的翻译

mysql - 如何在 MySQL 中构建列表?

authentication - Alexa 是否/可以替换其为链接用户生成的 UserId?

php - WooCommerce 产品图片尺寸未保存

php - 查询始终返回特定行

php - React/Php/MySQL - 通过 REST API (AJAX) 以两种方式发送变量

MySQL 通过 REGEXP 匹配的计数来增加字段

ruby-on-rails-3 - 在 Rails 3 中选择性地关闭设计的闪光通知

ios - Objective-C - DropboxSDK : (401) Authentication failed -