RE: [PHP] New problem - HELP! [SOLVED]

From: Date: Thu, 13 Nov 2003 23:23:34 +0000
Subject: RE: [PHP] New problem - HELP! [SOLVED]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169606@lists.php.net to get a copy of this message
> -----Original Message----- > From: Jake McHenry [mailto:linux@nittanytravel.com] > Sent: Thursday, November 13, 2003 6:12 PM > To: 'David T-G' > Cc: php-general@lists.php.net > Subject: RE: [PHP] New problem - HELP! > > > > -----Original Message----- > > From: David T-G [mailto:davidtg-php@justpickone.org] > > Sent: Thursday, November 13, 2003 5:09 PM > > To: PHP General list > > Cc: Jake McHenry > > Subject: Re: [PHP] New problem - HELP! > > > > > > Jake -- > > > > ...and then Jake McHenry said... > > % > > % I have a csv file I'm importing, very simple setup. I think > > I must be > > % going blind from sitting infront of this puter for so long :-( I > > % can't seem to see what I did wrong. Here's my stuff: > > % > > % Csv file: > > % > > % 01000170600010, > > % 27362538462735,154154162549184 > > > > OK. > > > > > > % > > % Basically, some lines have 2, some only have the first, > > only the % second will ever be empty. > > > > Question: is it empty or is it actually undefined? > > > > > > % > > % In my php file: > > ... > > % if ($value[1] == "") > > % { > > % echo "hi"; > > > > This could happily fail; undefined is not the same as "" and so on. > > > > > > HTH & HAND > > > > :-D > > -- > > David T-G * There is too much animal courage in > > > (play) davidtg@justpickone.org * society and not sufficient > > moral courage. > > (work) davidtgwork@justpickone.org -- Mary Baker Eddy, > > "Science and Health" > > http://justpickone.org/davidtg/ Shpx gur > > Pbzzhavpngvbaf > > Qrprapl Npg! > > > > > > You asked is it empty or actually undefined...? I showed you > the csv file, and the output of print_r... You tell me.. I > don't know.. Lol > > Some of the lines in the csv file end with the comma, others > end with the second number. I then use explode in the php > script, createing $value[0] and $value[1]. According to > print_r($value) both are defined, and with the lines that end > in the comma, $value[1] is empty. This is why I don't know > why my if condition is not being entered. > > What can I change the if condition to so that it'll work? > > > > Thanks, > > Jake McHenry > Nittany Travel MIS Coordinator > http://www.nittanytravel.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I got it... It wasn't being showed, but $value[1] only contained the newline \n character if there wasn't anything to fill it from the csv file. I changed my if condition to if ($value[1] == "\n") and it then went inside the condition. Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com

« previous php.general (#169606) next »