observe the code
if($line[$x]==1 and !empty($cat_ids[$x]))
array_push($cat1,$cat_ids[$x]);
elseif($line[$x]==1 and $cat_ids[$x]="")
array_push($cat1,"id not allocated");
$line[$x] contains 1 and $cat_ids[$x] contains the id.
when the id is empty, i want to push “id not allocated” into the array at that particular $line[$x]. Please help me…
the code i written is skipping the empty field instead of printing ‘id not allocated’
Try changing
to
as
$cat_ids[$x]=""statement will assign the value null to$cat_ids[$x]