Page 1 of 1

retrieve data from text file (blank lines)

Posted: Thu Sep 03, 2009 5:07 am
by prue_
(Edited: I believe I'm on the right topic now)
I want to put a validation for blank line.. the code I created read data from text file line by line using fgets.. I want to show the text "Not available" if there's a blank line... I tried the ff:

Code: Select all

if (empty($variable))
if ($variable==NULL)
if ($variable =="")
if ($variable =="\r\n")
 
NULL and "" don't work

though if ($variable =="\r\n") and if (empty($variable)) works, it replaces everything because all data have spaces, tabs, etc..... what if i only want to read "blank line" only?? (between name 3 and name 4)
(e.g. from text file)
name1
name2
name3

name4

can you give me an idea on this? thanks in advance.... any idea will be very much appreciated

Re: scroll text from external text file

Posted: Thu Sep 03, 2009 7:02 am
by Ollie Saunders
This forum is call "PHP - Code" and you just posted a load of JavaScript without any PHP.