Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16946

Re: Issue with extracting values from the string (initially from a file) to insert in sql table

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Issue with extracting values from the string (initially from a file) to insert in sql table
Date 2016-08-20 14:55 +0200
Organization solani.org
Message-ID <np9jvt$d9f$1@solani.org> (permalink)
References <941efc61-cbb4-4c80-bf33-6455bf9828a1@googlegroups.com>

Show all headers | View raw


On 20.08.2016 at 14:06, Alla wrote:

> I have stored a file US.txt in my home directory from http://download.geonames.org/export/zip/readme.txt
> Here is the quote from the exercise I am doing: "US.txt is quite like a CSV file except that fields 
> are delimited with \t (a tab character) instead of a comma. " Hence, I am using fgetcsv() function.
> 
>         // store the first row of US.txt in a new variable        
>         $new_entry = fgetcsv($open_file, '\t');

$delimiter is the *third* parameter of fgetcsv, not the _second_.  Also
heed Rudy's advice, that the tab character must be double-quoted.  So:

  $new_entry = fgetcsv($open_file, 0, "\t");

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Issue with extracting values from the string (initially from a file) to insert in sql table Alla <modelling.data@gmail.com> - 2016-08-20 05:06 -0700
  Re: Issue with extracting values from the string (initially from a file)to insert in sql table "R.Wieser" <address@not.available> - 2016-08-20 14:48 +0200
    Re: Issue with extracting values from the string (initially from a file)to insert in sql table Alla <modelling.data@gmail.com> - 2016-08-20 08:13 -0700
      Re: Issue with extracting values from the string (initially from afile)to insert in sql table "R.Wieser" <address@not.available> - 2016-08-20 18:06 +0200
    Re: Issue with extracting values from the string (initially from a file)to insert in sql table Alla <modelling.data@gmail.com> - 2016-08-20 08:30 -0700
  Re: Issue with extracting values from the string (initially from a file) to insert in sql table "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-08-20 14:55 +0200
  Re: Issue with extracting values from the string (initially from a file) to insert in sql table He <y12983@mail.ee> - 2022-02-02 02:23 -0800

csiph-web