The CSV contains this:
Code: Select all
"1","Dirk Breeuwer","d78c03d72e72b44a131d255aec3c8a11","0","00:00:00",
"2","Pedro","d78c03d72e72b44a131d255aec3c8a11","0","00:00:00
"3","Javier","d78c03d72e72b44a131d255aec3c8a11","0","00:00:00",- ID, username, password, voted, time, partido
Code: Select all
<?php
//database variables
$dbHost = "localhost";
$dbUser = "*******";
$dbPass = "*****";
$dbDatabase = "******";
//conect to database
$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");
$query = "LOAD DATA INFILE 'users.csv' INTO TABLE users FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
(ID, username, password, voted, time, partido)";
mysql_query($query) or die ('Error, query failed');
?> Also, by the way, does anyone know how to encrypt an Excel column? (With MD5 encryption). For example, for the passwords column. I need it to be encrypted.