Trying to check if username already exists in MySQL database using PHP

后端 未结 8 1919
无人共我
无人共我 2020-12-28 10:12

I\'ve looked at the many other posts that were similar to my issue and implemented their solutions (as far as I can tell) as exactly as I could. However, every time I execut

8条回答
  •  我在风中等你
    2020-12-28 10:45

    change your query to like.

    $username = mysql_real_escape_string($username); // escape string before passing it to query.
    $query = mysql_query("SELECT username FROM Users WHERE username='".$username."'");
    

    However, MySQL is deprecated. You should instead use MySQLi or PDO

提交回复
热议问题