Could not check username error, php & mySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ErraticFox
    New Member
    • May 2015
    • 1

    Could not check username error, php & mySQL

    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:

    Code:
    if(isset($_POST['username'])){ }
    	
    	$username = $_POST['username'];
    
    $username = preg_replace("#[^0-9a-z]#i","",$username);
    
    $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)
    Last edited by Rabbit; May 11 '15, 04:10 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    well, obviously your SQL query fails. that’s the only place that can trigger your error message.

    Comment

    • Exequiel
      Contributor
      • Jul 2012
      • 288

      #3
      ON YOUR QUERY IN LINE No. 7 replace it by this code.

      Code:
      $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='$user name'LIMT 1 it must be username='$user name' LIMIT 1 AND ALSO WRONG SPELLING OF LIMIT.

      Comment

      Working...