Jump to content

mutedgirl

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mutedgirl's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awesome! That was so simple, I knew I was making it more complicated than it needed to be (I do that a lot, heh) And actually, I was able to get it to work on an existing table by limiting the MD5 change to IDs greater than what was already in there: $sql = "UPDATE alumni_data SET password = md5(password) WHERE id > 94"; Thanks so much!
  2. Hi- I am trying to import data to a database via a CSV file. Everything is working just fine (yay!) but I need to convert one field (password) to md5 encoding so that it is stored in the database properly. As it is now, it's stored in the database in it's original form. Example, say the password is 'bluebird', it's stored as 'bluebird'.. I need it to be stored as md5(bluebird) which ends up as a (seemingly) random string. I was trying to figure out a way to have this script stop at the third column, md5 it, then keep going like normal. But I can't figure out how to do it. Here's the import script I'm using (didn't write it myself, found it on another very helpful site!): $fcontents = file ('./database2.csv'); # expects the csv file to be in the same dir as this script for($i=0; $i<sizeof($fcontents); $i++) { $line = trim($fcontents[$i], ','); $arr = explode(",", $line); #if your data is comma separated # instead of tab separated, # change the '\t' above to ',' $sql = "insert into alumni_data values ('". implode("','", $arr) ."')"; mysql_query($sql); echo $sql ."<br>\n"; if(mysql_error()) { echo mysql_error() ."<br>\n"; } Or if there is another, better way to import, I'm all ears. But, as I said, the import works great- I just need to modify one of the fields BEFORE it's imported. Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.