Chris, I couldn't find any readline function in the manual - did I miss it?
It isn't as simple as you say, because, to start with, I don't know how many fields there are going to be, I don't know how I'm going to build my array to record-level sets. I'm not really looking for someone to provide the code (snippets accepted though) but I would appreciate being pointed in the right direction. Cheers George > -----Original Message----- > From: Chris Kranz [mailto:[EMAIL PROTECTED]] > Sent: 11 February 2003 12:04 pm > To: [EMAIL PROTECTED] > Subject: RE: [PHP-WIN] reading lines from a file > > > So all you need to do, is read the file in, line by line (see the php > manual) and then break up each line into an array to be added to the db. > > This is fairly basic stuff, you just need to look in the php manual, it > sounds like you don't really have a problem as such, you just want > someone to tell you what the code would be? > > chris kranz > fatcuban.com > > > -----Original Message----- > From: George Pitcher [mailto:[EMAIL PROTECTED]] > Sent: 11 February 2003 11:59 > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED] > Subject: RE: [PHP-WIN] reading lines from a file > > Yes, I suppose I do. > > I want to be able to take my file, work out a complete of fieldnames and > then create an array which could then be used to, initially, create a > table > in MySQL. > > I'm not using MySQL for my main system which is based on FileMaker, but > will > be moving later this year to MySQL, so it's not a wasted effort. > > I know that I can export the MySQL data and push that into FileMaker. > > Below (in between ==== lines, is a sample record for parsing. This may > help > you understand the problem I have. > > ======================================================= > NEWRC -T&F eBook data rec.1534 |@ 27/01/2003 > VISBN 0203445570 > OSBN 0-203-44557-0 > EBK1 0203548310 > EBK2 0203651057 > EBK3 020375381X > EBK4 0203273567 > OTOP > OTART > OTI Creative Mathematics > OSUB > USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada > USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada > USAU Higginson |f William |u Queens University |c Kingston |x Canada > EDIT > INTRO > FORWD Pimm |f David |u The Open University x| UK > TRANS > 2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative > Mathematics > VPR 11.99 > USPRI 17.99 > OTBPR 19.99 |U 25.95 |D 17/07/1997 > USBDG > MFDT > ERT GB US CA AU NZ ZA IE > ORT > NRT > TTY > OBIND eB > PDUE 11/03/2002 > VIZE > VEXT 192 > OILLS 40 illustrations > LEVEL > OSER > OIMP RoutledgeFalmer > LIBPR > OALT > OPPQ > OCATL This book shows how creative maths can <I>really</I> work. > Exploring > the ways in which maths skills can be learned through cross-curricular > activities based on visual arts and music, the book presents maths as a > meaningful and exciting subject which holds no fears for children.<BR> > The > authors recognise that while maths-phobia prevails in our increasingly > mathematicised world, attitudes and approaches to teaching the subject > need > to be reviewed, and issues such as gender stereotyping, which encourage > maths-apathy, need to be tackled at an early stage.<BR> Within this > collection of classroom-based stories are detailed examples of > integrative > mathematic projects; these will give teachers the confidence to try out > cross-curricular activities in their classes. The book also provides > support > with difficult areas such as assessment, planning and development.<BR> > Fascinating to read in its own right this book will appeal to the > specialist > and non-specialist alike.<BR> > OCONC This book shows how creative maths can <I>really</I> work. > Exploring > the ways in which maths skills can be learned through cross-curricular > activities based on visual arts and music, the book presents maths as a > meaningful and exciting subject which holds no fears for children.<BR> > The > authors recognise that while maths-phobia prevails in our increasingly > mathematicised world, attitudes and approaches to teaching the subject > need > to be reviewed, and issues such as gender stereotyping, which encourage > maths-apathy, need to be tackled at an early stage.<BR> Within this > collection of classroom-based stories are detailed examples of > integrative > mathematic projects; these will give teachers the confidence to try out > cross-curricular activities in their classes. The book also provides > support > with difficult areas such as assessment, planning and development.<BR> > Fascinating to read in its own right this book will appeal to the > specialist > and non-specialist alike.<BR> > OCATS Exploring the ways in which maths skills can be learned through > cross-curricular projects on arts and music, this book presents maths as > a > meaningful and exciting subject which holds no fear for children. > OQUO 'This is a fascinating book ... which gives detailed case > studies.' |I > Infant Equipment > OCNT > FCONT > OWRIT > VEDIT 1 > BICAC U > BSUB1 J > BSUB2 JD > BSUB3 > BICAV RF > SUBJ1 SB150000 > SUBJ2 > SUBJ3 > VPROD EB > VACDE WEB > CREAT MFK - AUTO |D 2002 07 19 > ================================================================ > > the use of '|' denotes a subfield. My plan is to name the subfield by > the > name of the field followed by '_' and the subfield identifier, so that > the > one on the last line would appear as 'CREAT_D, and that way I'll be sure > to > properly tag those that are belonging to the 'counter-affected' fields. > > All help is appreciated. > > Cheers > > George > > > -----Original Message----- > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]] > > Sent: 11 February 2003 11:03 am > > To: George Pitcher; [EMAIL PROTECTED] > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > Then you need to write a parser. What's the basic problem then? > > > > > -----Original Message----- > > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, February 11, 2003 11:59 AM > > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED] > > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > > > > Yes, eventually. I want to come up with a good method because > > this file is > > > going to be supplied to me on a fairly regular basis. > > > > > > George > > > > > > > -----Original Message----- > > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]] > > > > Sent: 11 February 2003 10:56 am > > > > To: George Pitcher; [EMAIL PROTECTED] > > > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > > > > > > > What do you want to do? Parse the file into tab-delimited data > > > > in order to bulk load it into the database? > > > > > > > > > -----Original Message----- > > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > > > > Sent: Tuesday, February 11, 2003 11:41 AM > > > > > To: [EMAIL PROTECTED] > > > > > Subject: [PHP-WIN] reading lines from a file > > > > > > > > > > > > > > > Hi, > > > > > > > > > > I have a huge file that I want to get into a db format. > > > > > > > > > > There are over 5000 records and I need to create fieldnames > > on the fly. > > > > > > > > > > Each record comprises a number of lines (fields) containing > > 2 elements > > > > > (fieldname [first 5 chars (which need rtrimming)], value [rest > > > > of line, some > > > > > with lots of text]). > > > > > > > > > > Some fieldnames are duplicated within a record so I need to > > > > rename these by > > > > > using a counter which is reset for each record (there are at > least 5 > > > > > fieldnames that are affected this way - so 5 counters). > > > > > > > > > > Some values contain subfields so I need to be able to handle > > > > these, but this > > > > > doesn't look frightening. > > > > > > > > > > And I would like to end up with an array with keys (fieldnames) > > > > and values. > > > > > > > > > > But I'm stuck at the first hurdle because I can't find out how > > > > to put a line > > > > > into a string. > > > > > > > > > > Any pointers? > > > > > > > > > > George in Oxford > > > > > > > > > > > > > > > === > > > > > > > > > > George Pitcher > > > > > HERON Technical Manager > > > > > Ingenta plc > > > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET > > > > > T +44 (0)1865 799137 direct > > > > > T +44 (0)1865 799000 switchboard > > > > > F +44 (0)1865 799134 > > > > > E [EMAIL PROTECTED] > > > > > > > > > > www.ingenta.com > > > > > Ingenta: Empowering the exchange of academic and > > professional content > > > > > online. > > > > > > > > > > > > > > > -- > > > > > PHP Windows Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php