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

Basically, some lines have 2, some only have the first, only the
second will ever be empty.

In my php file:
foreach($lines as $line => $value)
{
  $value = explode(",", $value);

print_r($value);

  if ($value[1] == "")
  {
echo "hi";
    $value[1] = "0000000000000000";
  }

//  $result = mysql_query("INSERT INTO accounts (accountid,ccnumber)
VALUES ($value[0],$value[1])"); //  if ($result == 1) //  {
//    echo "$line = $value[0] - $value[1] complete!<br>\n";
//  }
//  else
//  {
//    echo "$line = $value[0] - $value[1] FAILED!<br>\n";
//  }
}


Output of print_r($value)
Array
(
    [0] => 01000170600010
    [1] => 

)



The script is never entering the if condition, as the message "hi" is
never being displayed, and $value[1] is never set to all zeros.... Why
is it not entering the if condition? The value[1] is empty sometimes,
but even when it is, it's not going into that condition.

If both values are there, then it works fine, because it doesn't need
to go into that condition.


If anyone would like to contribute for a new pair of glasses so I can
see what I'm doing... Please send to [EMAIL PROTECTED]  LOL


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

Reply via email to