Welcome Guest, Not a member yet? Register   Sign In
Database Error Number: 0
#4

[eluser]Dennis Geus[/eluser]
ok,
well it's working.

Code:
$path = './uploads/';
$file = $upload_data['file_name'];
if ($upload_data['file_ext'] == ".csv") {
$fieldterm = ";";
$lineterm = "\\r\\n";
}
if ($upload_data['file_ext'] == ".txt") {
$fieldterm = "\\t";
$lineterm = "\\r\\n";
}

$this->db->simple_query("LOAD DATA LOCAL INFILE '".$path.$file."' INTO TABLE temp FIELDS TERMINATED BY '".$fieldterm."' LINES TERMINATED BY '".$lineterm."' IGNORE 1 LINES");

The only problem is that it always returns als FALSE (but it inserts the data), so I can't do any checks with it.

I think I'll have to do a query on the temp table to see if it has data before I continue with the rest.


Messages In This Thread
Database Error Number: 0 - by El Forum - 02-22-2011, 07:04 AM
Database Error Number: 0 - by El Forum - 02-22-2011, 08:20 AM
Database Error Number: 0 - by El Forum - 02-22-2011, 09:12 AM
Database Error Number: 0 - by El Forum - 02-23-2011, 02:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB