ferd Posted April 26, 2010 Share Posted April 26, 2010 Hello, Sorry, but after a while of searching for my subject, it doesn't appear that anyone else has had these particular set circumstances surrounding the error below. If someone could be so kind as to look at the following code and maybe tell me what I'm doing wrong. $user = $_POST['User']; $pass = $_POST['Password']; mysql_query("INSERT INTO users (name, passwd) VALUES('$user', ENCRYPT($pass,concat(\"\$1\$\",right(md5(rand()),,\"\$\"))) ") or die('DB' .mysql_error()); That query returns the following error: DBUnknown column 'pass1' in 'field list' Where pass1 is my posted password. I know it's the ENCRYPT() function, but for the life of me I can't figure out what exactly is wrong with it. The query works fine if I substitute ENCRYPT(...) with '$pass', and it also works ok using ENCRYPT()if the password happens to be all numbers. I tried different ways of using quotes but that didn't worked either. Thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/199727-dbunknown-column-pass1-in-field-list/ Share on other sites More sharing options...
cags Posted April 26, 2010 Share Posted April 26, 2010 The value you are entering is a string, all strings handled within an MySQL query have to be delimited by quotes so that the MySQL engine can distinguish it from key works. mysql_query("INSERT INTO users (name, passwd) VALUES('$user', ENCRYPT('$pass',concat(\"\$1\$\",right(md5(rand()),,\"\$\"))) ") or die('DB' .mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/199727-dbunknown-column-pass1-in-field-list/#findComment-1048437 Share on other sites More sharing options...
ferd Posted April 26, 2010 Author Share Posted April 26, 2010 Thank you so much. A GURU indeed. I'm really not that good at this, but I'm trying. Everything's working as it should now. Regards, Ferd Quote Link to comment https://forums.phpfreaks.com/topic/199727-dbunknown-column-pass1-in-field-list/#findComment-1048487 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.