Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Question Re-creating Table Values

    Hey All,

    I have just finished making a v3 for one of my scripts on my site and now I am running into a problem when trying to create the upgrader. See in v3 I used md5 encryption for passwords and etc, so I now need a query that I can run on my MySQL Database that will basically go through a specific table and take every entry for "passwrd" (yes passwrd not password) and md5 encrypt it and then re-enter it into the database.

    I know how to do the basic selecting, deleting, updating, etc but I didn't know how I would go about doing this for an entire table.

    Actual code would be great! Thanks in advance for any help!
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #2
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    just dont use a where statement, it will then apply to all rows.

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Code:
    UPDATE `table` SET `passwrd` = MD5(`passwrd`)

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Quote Originally Posted by iLLin View Post
    just dont use a where statement, it will then apply to all rows.
    huh lol

  • #5
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Nightfire View Post
    huh lol
    UPDATE my_table SET password = 'skillz'.

    That would update ever single row in that table with the password skillz.

  • #6
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Thanks for all the replies... although I don't quite get the last one... but anyways.....

    So all I have to do is the UPDATE query above and it will automatically apply it to every row within the table?

    Thanks again!
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Yes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •