RE: [PHP-DB] Re: Update MD5 field

2003-03-03 Thread John W. Holmes
[snip]
> If I understand you correctly, this is probably something like what
> you want to do:
> 
> ALTER TABLE foo ADD bar VARCHAR(20);
> 
> (don't know how long the field needs to be).

MD5() result is always 32 characters.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Update MD5 field

2003-03-03 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Dani Matielo) writes:
> my problem is the following: I just imported a csv file to a MySQL database
> that contains name and email fields. It has about 9k lines on it and I need
> a new field that orinally didn't exist called "code" thats suposed to be
> 
> MD5(name.email)
> 
> I know how to do this for new data, but I don't know how to update all the
> old ones I already have there.

If I understand you correctly, this is probably something like what
you want to do:

ALTER TABLE foo ADD bar VARCHAR(20);

(don't know how long the field needs to be).

UPDATE foo SET bar = MD5(baz);


-- 
--Fredrik
"Spare no expense to save money on this one."
-- Samuel Goldwyn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php