[Pugged] Coding Questions
Angie Tollerson
ciapug@ciapug.org
Tue, 04 Mar 2003 15:39:22 -0600
OOPS, don't know if that last email went thru..but i wasn't read to send
it, i'll try again:
$handle = fopen ("/tmp/inputfile.txt", "r+");
$i = 0;
$newbody = "";
while (!feof ($handle)) {
$buffer = fgets($handle, 4096);
if($i > 0){
$newbody .= $buffer;
}
$i++;
}
fputs($handle,$newbody);
fclose ($handle);
Angie Tollerson
Alliance Technologies Web Programmer
(515) 245-7628
tollerson@alliancetechnologies.net
>>> chettinger@efr.org 03/04/03 09:52 AM >>>
So anyone have any ideas on how to approach this? Dave said he would
have to research it...
*hrmm*
-ch
-----Original Message-----
From: Chris Hettinger [mailto:cjh@raccoon.com]
Sent: Tuesday, February 25, 2003 9:50 PM
To: ciapug@ciapug.org
Subject: [Pugged] Coding Questions
[This may come a second time, damn email delays]
I have a db table that I periodically need to update with a new set of
data. To do this I run a script to empty and reload the table with the
contents of a comma separated value text file. I am working on
automating that a little bit and have a question...
The text file that I receive to upload has a line, the first line
specifically, that I need to trim off before the reload happens. The
line is just the field names inserted when it is output from another
table, the line is useless and will cause errors if I simply to a reload
based on this text file with it in there. Example:
"id","LocationID","StatusID","KeywordDesc","Zip" <--------- Trim this
line.
5555,55555,"P","KeywordDesc","50309"
I haven't yet done much with file access (fopen...) and to be honest I
am not sure what this problem requires to solve, thought I think I need
to open the file, trim the line, then close the file before doing the
reload with it...
If anyone could nudge me in the right direction I would greatly
appreciate it.
Chris Hettinger
_______________________________________________
Ciapug mailing list
Ciapug@ciapug.org
http://cialug.org/mailman/listinfo/ciapug
_______________________________________________
Ciapug mailing list
Ciapug@ciapug.org
http://cialug.org/mailman/listinfo/ciapug