RE: [PHP] New problem - HELP!
| From: | Jake McHenry | Date: | Thu, 13 Nov 2003 23:11:57 +0000 |
| Subject: | RE: [PHP] New problem - HELP! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169605@lists.php.net to get a copy of this message | ||
> -----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