I'm trying to create and read some csv files and display them using html but it's giving me some errors :/ , I followed a tutorial on youtube but it still gives me an error and I don't understand why
I used 3 columns in excel and i put some text but when I go to test it, it puts it in just one column
i tried to use var_dump function to check $data to see what i was getting through fgetcsv and i get this: "bool(false)"
I noticed that when saving an excel file, 3 or 4 options appear to save as csv
I chose "CSV(separated by commas)", i don't know if this could be the problem
this is the code i have: Code1,Code2
CodePudding user response:
It is because your delimiter in the file is a semi-colon. But the delimiter set in "fgetcsv" is a comma.
You have to change that to a semi-colon.
Like this:
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE)