PHP: MySQL INSERT INTO Producing blank table entries -



PHP: MySQL INSERT INTO Producing blank table entries -

i've created simple login scheme in php, after coming code after several weeks, i'm left stumped why insert query not function properly;

$query = mysql_query("insert `user` (`username`, `password`, `email`) values ('$username','".md5($password)."','$email')") or die(mysql_error());

now, inserts row user table username, bizarre reason end empty md5 hash, , empty email field. i've gone on code , echoed variables , can confirm they're available code access, not understand what's wrong query.

i can hope it's issue syntax, life of me can't see it. puzzling when seemed working fine few weeks ago.

when looking $_post using print_r;

array ( [username] => myusername [password] => mypassword [email] => myemail [register] => register ) myusername

so input info there, not transfering variables.

solved:

if($username == "" || $password = "" || $email = "")

instead of:

if($username == "" || $password == "" || $email == "")

i accidently assigning empty strings $password , $email, , because assumed there nil wrong if statement, , fault must have been sql or form input, didn't bother @ until echoed out variables @ various stages within script see going awry.

php mysql database insert-into

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -