I am trying to parse through cities in a file to put into my database. Here is the initial piece that breaks:
for ($num=0;$num<sizeof($filearray);$num++) {
$info = explode(",", $filearray[$num]);
$city = $info[0];
$province = $info[1];
if ($city == "" || $city == 0) die("Unable to get city ($city, $info[0])<br />".$filearray[$num]);
}
It dies everytime on the first city with this output:
Unable to get city (Brooks, Brooks)
Brooks,Alberta
Somehow it is evaluating $city as 0 and triggering the die. Also, if I take away the error message, it inputs the data as 0 everytime.