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

Path csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
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 Sat, 20 Aug 2016 14:55:46 +0200
Organization solani.org
Lines 17
Message-ID <np9jvt$d9f$1@solani.org> (permalink)
References <941efc61-cbb4-4c80-bf33-6455bf9828a1@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1471697725 13615 eJwNyMEBwCAIA8CVVEgo46iE/Uew9zwYJ284QUejj7QG5lmsK7/SKFMqEUT0v9WGCu5PsVP2ADMhEdc= (20 Aug 2016 12:55:25 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sat, 20 Aug 2016 12:55:25 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
In-Reply-To <941efc61-cbb4-4c80-bf33-6455bf9828a1@googlegroups.com>
X-NNTP-Posting-Host eJwNwoERwCAIBLCVEPhHxwGR/UdoL4Fx8YYTdMzv2ANmKyQXpa3mxnjFaLYKD7e/kmQqW9M+FMgQ+Q==
Cancel-Lock sha1:SokadMtEprLcdsXgFNFtZLpMDko=
X-User-ID eJwFwQUBwEAMBDBLpSvI+RX8S1gCdfYOc7jhcAnTia/dkneiIykhyMd6WU22VqxSK/uah34JHhB9
Xref csiph.com comp.lang.php:16946

Show key headers only | 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