By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,751 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Could not check username error, php & mySQL

P: 1
Hello, for some reason everytime I register on my website, I get "Could not check username" no matter what I use. I'm sure it might be a spelling mistake(?) but I've looked through everywhere and couldn't find it.

Here's my snippet:

Expand|Select|Wrap|Line Numbers
  1. if(isset($_POST['username'])){ }
  3.     $username = $_POST['username'];
  5. $username = preg_replace("#[^0-9a-z]#i","",$username);
  7. $user_query=mysql_query("SELECT username FROM members WHERE username='$username'LIMT 1") or die ("Could not check username");
(Again, this is just a snippet of my php)
May 11 '15 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,639
well, obviously your SQL query fails. thatís the only place that can trigger your error message.
May 12 '15 #2

P: 287
ON YOUR QUERY IN LINE No. 7 replace it by this code.

Expand|Select|Wrap|Line Numbers
  1. $user_query=mysql_query("SELECT username FROM members WHERE username='$username' LIMIT 1") or die ("Could not check username");
the error there IN YOUR CODE is that you don't put space between this - username='$username'LIMT 1 it must be username='$username' LIMIT 1 AND ALSO WRONG SPELLING OF LIMIT.
May 14 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.