Slow rendering html table using PHP -
i trying create dynamic html table using php , mysql. executing sql , retrieve records array, , using "foreach" create rows , cells. sql execution works fast, problem (i think) in rendering html table. there less 1000 rows , 3 columns, takes page (actually popup) 1.5 minutes show up.
php code:
$j = 0; foreach ($theitems $k => $l) { $j++; $tablestring = $tablestring.'<tr id="row'.$j.'">'; $tablestring = $tablestring.'<td class="text-left width40" style="padding-left: 10px;">'.preg_replace('(\\\)', '', urldecode($l->name)).'</td>'; $tablestring = $tablestring.'<td class="width25"><div class="raty" data-name="'.$l->id.'[]"></div></td>'; $tablestring = $tablestring.'<td class="center" width=35%><textarea name="'.$l->id.'[]"></textarea></td>'; $tablestring = $tablestring.'</tr>'; /*echo '<tr id="row'.$l->index.'">'; echo '<td class="text-left width40" style="padding-left: 10px;">'.preg_replace('(\\\)', '', urldecode($l->name)).'</td>'; echo '<td class="width25"><div class="raty" data-name="'.$l->id.'[]"></div></td>'; echo '<td class="center" width=35%><textarea name="'.$l->id.'[]"></textarea></td>'; echo '</tr>';*/ }
after finish creating html string echo it; mentioned takes minute , half.
Comments
Post a Comment