How to import a csv with a column md5 to mysql -


i'm trying import .csv file mysql

this .csv file:

 ,ai,md5('airt2015'),rrhh,14,,,aion s.a. de c.v., 

and ismy db's structure:

enter image description here

when upload .csv file see password .csv file...

any idea how upload encrypted?

thank you

for start, there posts on web why using md5 alone storing passwords not great idea, (see great answer or search google more info on this) achieve want using md5 hash example, need have password in .csv file without md5() wrapper , use kind of scripting language parse file , insert values database. example, if web application might use php along lines of following:

<?php // database variables, change these details $dbhost = 'localhost'; $dbusername = 'username'; $dbpassword = 'password'; $dbname = 'database'; $tablename = '`table`'; // file path $filepath = 'path/to/file.csv';  // connect database $db = mysqli_connect($dbhost, $dbusername, $dbpassword, $dbname);  // contents of file array of lines $lines = file($filepath);  // loop through lines in array foreach($lines $line) {     // split lines comma     $split = explode(',', $line);     // know password third element in array...     // hash , push in same point in array     $split[2] = md5($split[2]);     // build sql query     $sql = "insert {$tablename} (id_asociado,username,password,...) values ('" . implode("','", $split) . "')";     // run query , put result variable     $result = mysqli_query($db, $sql);     if ($result === true) {         echo "record created => " . $line . php_eol;     } else {         echo "insert failed error => " . mysql_error($db);     } } 

for more info on using php , mysqli, see here. have loads of great examples , explanations, particularly on dual interface , statements pages.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -