Jump to content

DBUnknown column 'pass1' in 'field list'


Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/199727-dbunknown-column-pass1-in-field-list/
Share on other sites

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());

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.