Hi,
you can run the following query from your mysql console ot from a php script

update table_name set field_name=password(field_name);

Be very careful because you will not be able to see the unencrypted data in your table 
afterwards. I recommend that you backup your
table before running the  UPDATE query.

As long the MySQL passwords are always 16 char long you might consider altering the 
column type to char(16)

ALTER TABLE table_name CHANGE field_name field_name CHAR (16) not null;

Hope this helps

Dobromir Velev
Web Developer
www.websitepulse.com


-----Original Message-----
From: Trond Erling Hundal <[EMAIL PROTECTED]>
To: Mysql Mailinglist <[EMAIL PROTECTED]>
Date: Friday, November 30, 2001 15:57
Subject: [PHP-DB] How to update all the column types in a table...


>I need to change a varchar into password(varchar) for a password column.
>What is the common SQL syntax to do this.
>
>The table allready has all of the password's stored. I just need to encrypt
>them with password($value)
>
>...Or will I have to just make a php script to extract and update?
>
>   __   _
>  / /  (_)__  __ ____  __
> / /__/ / _ \/ // /\ \/ /  . . .  t h e   c h o i c e   o f   a
>/____/_/_//_/\_,_/ /_/\_\              G N U   g e n e r a t i o n . . .
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to