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

Showing selected item at top of list
Hi,

I've got a list of names which i am fetching from database like this:
$qry = db_query

Pagination
Okay here is the page in question: http://blenderteachings.000a.biz/tutorials.hamishhill.php

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

array empty
Hiya peeps,

Ok here is the codes.

order.php

Code:

word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor

data type in column definition
Hi,
I create a table with column called "Direction of Travel code ".
The travel codes in t

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

Why does my crawler script suddenly end with no error?
Hi.

I have written a web crawler script. It will visit a large number of URL's with cURL.

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

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