ali_p wrote:Is there something that I am doing wrong?
First thing I notice that's wrong is that you're using [man]fread/man to read the entire file and not [man]fgetcsv/man to read each entry in the CSV one-by-one.
ali_p wrote:I would like to not include the first line of the csv as this is just cell names.
You can throw away the header line in a CSV simply by calling [man]fgets/man and ignoring the data (e.g. no need to store it in a variable or actually do anything with it).
Then again, if the names of the columns in the CSV have any correlation to the column names in the DB, it might be a lot easier to use [man]fgetcsv/man to retrieve the header row and use that array to keep the "names" of the cells when you retrieve the actual data. That way, you could ignore things like this:
$linearray = explode($fieldseparator,$line);
$linemysql = implode("','",$linearray);
which gives you no control over how the data is inserted into the SQL query.
EDIT: Also, there's no reason you should be using the '@' error suppressor (ever, IMHO). If you don't want errors, either write intelligent code that can handle error conditions or else turn off display_errors.