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

checkbox update
I am having a brain fart right now and i cant remember how to do this. if anyone could help that wou

IIS7 and getimagesize() problem
I have just discovered after hrs of trying to fix a problem where it's coming from. It's to do with

Transaction variant for VA02 not working
My requirement is to have transaction for user to only add the output and print a sales order.

add 20 000 to the rowcnt
Hi ...
I need to add 20 000 to the row count but just cant find a way to do this i am new to php

Inserting the current date/time while submitting the forum
What do I need to add below to update the current date/time? I have a field in the database called d

PHP and Javascript
Hello Everyone,

I have a page that needs a javascript code to be written between PHP code but

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

Had a simple form script that suddenly stopped working
It was made about a year ago and had been working fine. Last time it was known to work for sure was

Extracting Long text from message class with parameters
Hi,

I would like to extract the long text from a message class. However, the long text ha

help understanding hidden input w/ php
hello i'm doing a tutorial where there are multiple forms for an edit page for a user to update thei

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