Hey All,
I have a code snip below and am wondering if there is a cleaner way to do this. Right now the more data that starts to show (not that much) starts slowing the page load time down a quite a bit. Simply put what this is doing is displaying some tables with rows/columns and putting user names under specifc sections. The code snip is for one section, but I have three copies of this section for type1,type2 and type3
echo "<tr><td><table align=center width=100% style=\"border:0px solid black; font-size: 12px; font-family: 'Arial';\"><tr><td $tdb bgcolor=336699>User Type 1</td></tr></table></td></tr>";
//sql call looking for all users with Type1 status
$tmpquery = "SELECT * FROM teams WHERE user_status = 'Type1'";
$TeamList = new db_request();
$TeamList->openTeams($tmpquery);
$TeamList_Count = count($TeamList->teams_id);
//Count div by 2 round up to get rows needed for display
$team_row_count = ceil($TeamList_Count / 2);
echo "<tr><td><table align=center width=100% style=\"border:0px solid black; font-size: 12px; font-family: 'Arial';\">";
for ($z=0; $z < $team_row_count; $z++){
echo "<tr align=center>";
//col count, gives us 2 columns with as many rows as is needed.
for ($l=0; $l < 2; $l++) {
echo "<td>";
echo "<br>";
$c++;
//Gets us each unique user id.
$user_id = $TeamList->teams_user_id[$c-1];
$tmpquery = "SELECT * FROM users WHERE id = '$user_id'";
$User_List = new db_request();
$User_List->openUsers($tmpquery);
$first_name = $User_List->users_first_name[0];
$last_name = $User_List->users_last_name[0];
echo "$first_name $last_name";
echo "</td>";
}
echo "</tr>";
}
echo "</table></td></tr>";
unset($c);
Everything works perfect, so working is not the issue, I am just concerned about performance. Since this script is in three areas, when there are lots of users pulled it tends to take a lot of load time. Any ways to improve the processing speed of this? thanks!