Question

The csv file contains 37,000 lines but it only displays up to 22,000 lines

$csv = fopen('1'.'.csv','r') or die("can't find file");
echo "<table border=1 >";
echo "<tr><th>ID</th><th>Title</th><th>Gender</th><th>First</th><th>Middle</th><th>Last</th><th>Country Code</th><th>Primary Number</th><th>Secondary Number</th><th>Primary Address</th><th>Address 2</th><th>Address 3</th><th>City</th><th>State</th><th>Country</th><th>Zip</th><th>Email</th><th>Date of Birth</th><th></th><th>Bussiness Name</th><th>Business Number</th><th>Business Fax</th><th>Business Address</th><th>Business City</th><th>Business State</th><th>Businsess State</th><th>Notes</th></tr>";                                       
while($csv_line = fgetcsv($csv,0)) {

if($id == 0){
list($column[0], $column[1], $column[2], $column[3], $column[4], $column[5], $column[6], $column[7],$column[8], $column[9], $column[10], $column[11], $column[12], $column[13], $column[14], $column[15],$column[16], $column[17], $column[18], $column[19], $column[20], $column[21], $column[22], $column[23], $column[24]) = $csv_line;
//===TO LOWER=====
for($col_n = 0;$col_n <= $arr_count; $col_n++) {
$col_lower[$col_n] = strtolower($column[$col_n]);
}
//===SORT VALUE=====
echo 
'<tr><td>CODE:</td><td>';
for($col_n = 0;$col_n <= 16; $col_n++) {
echo $sort[$col_n].'</td><td>';
}
echo'</td><td>';
for($col_n = 17;$col_n <= $arr_count; $col_n++) {
echo $sort[$col_n].'</td><td>';
}
echo '</td></tr>';

    for($col_n = 0;$col_n <= $arr_count; $col_n++) {
        for($sort_n = 0;$sort_n <= $arr_count; $sort_n++) {
            if($sort[$col_n] == $col_lower[$sort_n]){
               $col[$col_n] = $sort_n;
            }
        }
    }   

}

if($id > 0){
list($column[0], $column[1], $column[2], $column[3], $column[4], $column[5], $column[6], $column[7],$column[8], $column[9], $column[10], $column[11], $column[12], $column[13], $column[14], $column[15],$column[16], $column[17], $column[18], $column[19], $column[20], $column[21], $column[22], $column[23], $column[24]) = $csv_line;
//===ECHO=====

echo 
'<tr><td>'.
$id.'</td><td>';
for($col_n = 0;$col_n <= 16; $col_n++) {
$data = ucwords(strtolower($column[$col[$col_n]]));
echo $data.'</td><td>';
}
echo  '</td><td>';
for($col_n = 17;$col_n <= $arr_count; $col_n++) {
$data = ucwords(strtolower($column[$col[$col_n]]));
echo $data.'</td><td>';
}
echo '</td></tr>';  
}
$id++;  



}
echo "</table>";
}
Was it helpful?

Solution

found the answer:

ini_set('memory_limit', '512M');
ini_set('max_execution_time', '180');

add this line on the top of your php file to adjust execution time and memory limit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top