fgetcsv Questions

7

Solved

I try to read a CSV and echo the content. But the content displays the characters wrong. Mäx Müstermänn -> Mäx Müstermänn Encoding of the CSV file is UTF-8 without BOM (checked with Notepad++...
Gaona asked 16/1, 2012 at 15:23

8

Solved

I want to delete the BOM from my imported file, but it just doesn't seem to work. I tried to preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $file); and a str_replace. I hope anybody sees what I'm doi...
Hominy asked 24/8, 2015 at 14:33

9

Solved

I am trying to import a CSV file. Due to the program we use, the first row is basically all headers that I would like to skip since I've already put my own headers in via HTML. How can I get the co...
Muna asked 5/6, 2012 at 16:26

6

Solved

I have a line like this in my CSV: "Samsung U600 24"","10000003409","1","10000003427" Quote next to 24 is used to express inches, while the quote just next to that quote closes the field. I'm rea...
Elielia asked 23/7, 2013 at 11:10

5

Solved

I have .csv file with 4 columns. What's the easiest way to remove a line identical with the id of the first column? Here's where I got stuck: if($_GET['id']) { $id = $_GET['id']; $file_handle = ...
Luann asked 1/11, 2010 at 18:45

3

Solved

I have a script which parses the CSV file and start verifying the emails. this works fine for 1000 lines. but on 15 million lines it shows memory exhausted error. the file size is 400MB. any sugges...
Oxygen asked 22/3, 2020 at 18:12

3

Solved

I am trying to read a certain data in my csv file and transfer it to an array. What I want is to get all the data of a certain column but I want to start on a certain row (let say for example, row ...
Dope asked 2/3, 2016 at 6:38

3

Solved

I have this script that I did, it basically grabs all the files in my "logs" folder and merge them all in one array file, my only problem is that, sometimes the script breaks if there is blank line...
Sharondasharos asked 19/8, 2013 at 22:51

2

I have a very curious issue whith fgtcsv(). Look at this code $csv_check = fopen(CSV_DIR.$this->db_table.".csv","r"); $data = fgetcsv($csv_check, 1000, $this->fields_terminated_by); fclos...
Rialto asked 23/4, 2015 at 15:51

6

Solved

here is my csv column1,column2,column3,column4,column5 column1_row1,column2_row1,column3_row1,column4_row1,column5_row1 column1_row2,column2_row2,column3_row2,column4_row2,column5_row2 column1_row...
Allonge asked 15/4, 2011 at 8:21

3

I have a CSV file where the first "cell" is just an int, 9, in this case. The next line is 10 for the first "cell" and so on. When I do $array = fgetcsv($file); the first cell of the first line has...
Lag asked 21/11, 2013 at 15:12

3

Solved

i have a code. on localhost i have not problem with reading csv file (with Unicode chars). but when upload code on host output is nothing. why? what is solution? while (($data=fgetcsv($fin,5000,"...
Italian asked 28/5, 2011 at 9:54

5

Solved

There seems to be an encoding issue or bug in PHP with fputcsv() and fgetcsv(). The following PHP code: $row_before = ['A', json_encode(['a', '\\', 'b']), 'B']; print "\nBEFORE:\n"; var_export($...
Michaeline asked 8/6, 2017 at 6:13

6

Solved

I have the following csv file: upc/ean/isbn,item name,category,supplier id,cost price,unit price,tax 1 name,tax 1 percent,tax 2 name,tax 2 percent,quantity,reorder level,description,allow alt. des...
Stalinist asked 4/4, 2011 at 13:19

6

Solved

Suppose I have a .csv file with the following content: "text, with commas","another text",123,"text",5; "some without commas","another text",123,"text"; "some text with commas or no",,12...
Zalucki asked 4/2, 2012 at 7:28

2

UPDATE 4: I've found (as suspected) that the files enconding is responsible for this. I converted the csv file from UCS-2 Little Endian to UTF-8 and everything works fine. Anyway I need to find so...
Afterward asked 26/11, 2013 at 19:10

3

Solved

I'm trying to determine how many columns a csv file has. Here's my script, which is only utilizing the first column, but I'm running slightly blind. I want to place a variable that limits the colu...
Expurgatory asked 6/10, 2011 at 17:36

2

I was parsing a csv file using php with fgetcsv function. It parsed all content in a line, later i found, csv contains carraige return as "\r". I saw - it was reported as php bug before. I've solve...
Prevocalic asked 27/12, 2010 at 20:52

3

Solved

I have this array with airport codes and city names (around 3500 lines). code,city "Abilene, TX ",ABI "Adak Island, AK ",ADK "Akiachak, AK ",KKI "Akiak, AK ",AKI "Akron/Canton, OH ",CAK "Akuton, A...
Empery asked 21/9, 2011 at 15:23

3

Solved

I have a csv file with 3 columns: email address, first name and last name. I have got the stage where I can print out the array using the following code: <?php $file = fopen("testEmails.csv","r...
Janessajanet asked 11/11, 2014 at 12:12

2

Solved

I'm trying to use fgetCsv but for some reason it is only reading the first line. Here is the code: $fieldseparator = ","; $lineseparator = "\r"; if(!file_exists($csvFile)) { echo "<div id='e...
Gooseberry asked 12/11, 2011 at 21:17

3

Solved

Using fgetcsv, can I somehow do a destructive read where rows I've read and processed would be discarded so if I don't make it through the whole file in the first pass, I can come back and pick up ...
Chapfallen asked 22/10, 2013 at 10:59

2

Solved

I'm building a simple shop system which takes its products from an array generated by a csv file. My csv is as following: pid;name;color 11149;Miro;"schwarz;weiß;blau;rot;gelb" 11004;FritzHansen;...
Laius asked 27/3, 2013 at 13:20

2

I'm looking for a very fast method to read a csv file. My data structure looks like this: timestamp ,float , string ,ip ,string 1318190061,1640851625, lore ipsum,84.169.42.48,appname and I'm us...
Court asked 9/10, 2011 at 21:1

2

Solved

Is it possible to make curl, access a url and the result as a file resource? like how fopen does it. My goals: Parse a CSV file Pass it to fgetcsv My obstruction: fopen is disabled My chunk o...
Gati asked 8/8, 2012 at 15:22

© 2022 - 2025 — McMap. All rights reserved.