Can anyone tell me why this doesn’t work? I am ashamed to say I just can’t figure it out.
I have set a key at the top of the page:
$key = 'ASKSDFNSDFKEISDJAHDLDSDF1235UUUiidfsdf';
Then I try to encrypt a user inputted password as it’s inserted into the database.
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frm_adduser")) {
$_POST['website']=str_replace('http://','');
$insertSQL = sprintf("INSERT INTO users (name, postcode, location, email, password, phone, category, website, facebook, twitter, logo, `description`, dateadded) VALUES (%s, %s, %s, %s, AES_ENCRYPT(%s,$key), %s, %s, %s, %s, %s, %s, %s, NOW())",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['postcode'], "text"),
GetSQLValueString($_POST['location'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['category'], "text"),
GetSQLValueString($_POST['website'], "text"),
GetSQLValueString($_POST['facebook'], "text"),
GetSQLValueString($_POST['twitter'], "text"),
GetSQLValueString($_POST['logo'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['dateadded'], "date"));
But I get an error telling me that
“Unknown column ‘ASKSDFNSDFKEISDJAHDLDSDF1235UUUiidfsdf’ in ‘field list’”
Can anyone see where I’m going wrong?