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

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

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

MSSQL/PHP
I am tryint to setup a webapplication developed in PHP, Apache2.0 and SQLServer2000 as backend which

help with php
It's not displaying or pulling anything out of the database.


Code: <html><

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

php calculate
this code echoes correctly the sum but the inserted result is 0??
Code: <?php
$TotalNum

PHP onsubmit in the form not going to the fuction.
I have a form through ‘onsubmit’ calling a function validation(). But not going to the

values in array being escaped
I would like to submit some values - back to the same form for checking before processing...

Creating a custom API
I'm creating a site, and I need to create a basic API. Unfortunately I have no idea where to start.

How do i do multi uploads?.
Hey i would like to do this : http://hosting.mrkrabz.net/

I've got the base down you can uplo

Help with some dates
I have a list of dates in an array:

$mondays = array(
strtotime("October 12, 2009

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