Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: PHP/MySQL Inserting Data
03-30-2007, 02:55 AM #1
PHP/MySQL Inserting Data
I posted about this before but when I finally tried it I got some weird errors because I was using my own custom encryption function. So basically I have a table with un-encrypted passwords, and I want to turn them all into encrypted ones. So I use this sql:
UPDATE TABLE rp_users SET passwrd = enc(`passwrd`)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`passwrd`)' at line 1
UPDATE rp_users SET passwrd = 'enc(`passwrd`)'
Any help would be really great! Thanks so much!
03-30-2007, 03:00 AM #2
Nevermind... finally got it to work... for anyone who wants to know the code is below:
$result = mysql_query("SELECT passwrd FROM users");
$row = mysql_fetch_array($result);
$cpass = $row['passwrd'];
$encpass = enc($cpass);
$queryf = "UPDATE users SET passwrd = '$encpass'";
$result = mysql_query($queryf) or die(mysql_error());