MYSQL With PHP Login Script Question?

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

Guest
Why does this take 2 times in the database to return username unavailable?

while($row = mysql_fetch_array( $result ))
{
if ($row['username']==$_POST[newusername])
$taken=1;

}



if ($taken==1)
{
echo "username unavailable";
}

I have a HTML form submitting to this using POST. This should get all of the arrays inside of my example database and check it with the username the user typed in, and display 'username unavailable' if it finds a match. For some reason, I have to submit the name twice before it realizes that the username is already taken. What's the deal?
nevermind!

I just wasn't refreshing my form before I re-submitted it. how stupid, lol

So anyways.

Anyone wanna tell a good joke =]
 
hey but here you need to check your $_POST data to avoid injection

$_POST[newusername]

i would

addslashes($_POST[newusername])

here is a joke for you

What do you call cheese thats not yours?

nacho cheese.
 
Back
Top