Jump to content
php.lv forumi

while un foreach


anonīms

Recommended Posts

  foreach ($server_list as $server)
 {
  $misc   = lgsl_server_misc($server);
$server = lgsl_server_html($server);

$alldata = mysql_query("SELECT * FROM serveri ORDER BY id ASC");
$col = 0;


while ( $row = mysql_fetch_array($alldata ) )
{
$col++;
if ( $col % 2 == 0 )
{
 $color = 'FFFFEE';
}
else
{
 $color = 'EEFFFF';
}



echo "
<tr bgcolor='#".$color."'>
<td><a href='#servera_info' title='{$misc['text_status']} | {$misc['text_type_game']}'>{$server['b']['ip']}:{$server['b']['c_port']}</a></td>
<td>{$misc['name_filtered']}</td>
<td>{$server['s']['map']}</td>
<td>{$server['s']['players']} / {$server['s']['playersmax']}</td>
</tr>";
 }
 }

 

 

Kā varētu viņus apvienot, lai visu neizvadītu divas reizes?

Link to comment
Share on other sites

×
×
  • Create New...