Jump to content

[SOLVED] for loop


Stooney

Recommended Posts

The following for loop is stuck in an infinite loop.  When I echo $i each loop it says it's value is 1 every time.  So for some reason $i is not incrementing by the 7 it should.

 

I am working with a csv file.  It is just a long comma delimited file.  There are 7 fields per row.

 

$count=3819;
$key=0;
for($i=1; $i<=$count; $i+7){
echo $i.' ';
$sql[$key]['biddernum']=$data[$i];
$sql[$key]['lname']=$data[$i+1];
$sql[$key]['fname']=$data[$i+2];
$sql[$key]['address']=$data[$i+3];
$sql[$key]['city']=$data[$i+4];
$sql[$key]['state']=$data[$i+5];
$sql[$key]['zip']=$data[$i+6];
$key++;
}

 

Example Output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Link to comment
https://forums.phpfreaks.com/topic/110865-solved-for-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.