I’m having a particularly interesting problem. Perhaps my “don’t remember the last time I slept” logic is failing…
Anyway, I’m grabbing a list of users from a database table and want to stick it in an HTML table. This works perfect:
$table->construct_header( $lang->username );
while ( $user = $db->fetch_array( $user_query ) )
{
$link = '<a href="'.$settings[ 'url' ].'/'.get_profile_link( $user[ 'uid' ] ).'" target="_blank">'.$user[ 'username' ].'</a>';
$table->construct_cell( $link );
$table->construct_row();
}
However, I want to have three columns. Naturally, I tried this:
$table->construct_header( $lang->username );
$table->construct_header( $lang->username );
$table->construct_header( $lang->username );
while ( $user = $db->fetch_array( $user_query ) )
{
$static $i = 1;
if ( $i <= 3 )
{
$link = '<a href="'.$settings[ 'url' ].'/'.get_profile_link( $user[ 'uid' ] ).'" target="_blank">'.$user[ 'username' ].'</a>';
$table->construct_cell( $link );
}
else
{
$table->construct_row();
$i = 1;
}
}
Except nothing gets outputted now. Is there some glaring issue I’m not seeing? I basically need to insert a username into three consecutive columns (straight across) and then generate that row and start again.
Here’s the basic approach I typically use:
I’m not familiar with MyBB’s table class, but this will likely work: