Undefined offset when using a flat file with pipe symbols


Posted on 16th Feb 2014 07:03 pm by admin

Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not advisable I know.. but still learning here).

In a section of code I need to separate the fields to make various checks later in the code

Did you know?Explore Trending and Topic pages for more stories like this.
I use this line to do that..

list ($name, $pass, $fileidnumber) = split ('|', $line);

Yet.. I keep getting "undefined offset" messages.. even when all 3 fields are filled in for all records.. eg..
Fred|bonkers|3n

Is it the new line causing the problem?

Also, the server is a bit peculiar in behaviour, it won't let me upload empty text files to start with (0kb).. the only way around it is for me to add a blank line or something to make it at least 1kb so the server notices it.. so in other words.. if Fred's record was the only one in the database, there'd be a space (I guess) underneath his record (all future records are added to the top of the file, but the space will always come last when checking)

If anyone out there can help or give ideas as to why this is happening I'd be grateful.. thanks
No comments posted yet

Your Answer:

Login to answer
190 Like 11 Dislike
Previous forums Next forums
Other forums

URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But

mr8m - reverse document
Friends,

I'm trying to reverse a document held by MIRO, but it reports the message balan

need help in update query
i create a form for update. there are 8 columns in my mysql table. on my main page all the data is r

Custom array sort? asc then desc
Any ideas how I could sort this array? I've been trying for a while. Maybe with usort, but I have no

what are '%S%', '%E%'
for example when i see Code: [Select]printf("Hello %srn", $name);
what does %s means

SOAP Issue
Hi,

I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.

Big Problem!! Please help
Hi Guys,

Im making a website for a friend have encountered a really annoying problem. When ev

Socket problem
Hello,

Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.

calculator
I can't figure out why this code doesn't work. No error messages. Page loads.

Code: <

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash