Hi
I have this code which reads the contents of a CSV file and inserts it into my database table, however, I am having a couple of problems with some records that do not insert.
Can someone point out where the mysql_real_escape_string function will be applied in order for them to be inserted?
[code=php]for ($i=1; $i<sizeof($filecontents); $i++) {
$line = trim($filecontents[$i], ',');
$arr = explode(",", $line);
$q= "INSERT INTO mytable (field1, field2, field3, field4)
VALUES ('". implode("','", $arr) ."')";
mysql_query($q);
}[/code]
Many thanks