anonīms Posted February 10, 2008 Report Posted February 10, 2008 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?
marcis Posted February 11, 2008 Report Posted February 11, 2008 Ko tavā uztverē nozīmē apvienot? Bet izskatās, ka tu pie katra masīva elementa selektē visu no datubāzes pa jaunu (tb visu laiku vienu un to pašu).
anonīms Posted February 11, 2008 Author Report Posted February 11, 2008 Kļūda labota, izdomāju kā izveidot bez while
Delfins Posted February 11, 2008 Report Posted February 11, 2008 tāpat tie tavi cikli nepareizi... N-x viens un tas pats SQL izpildās bezjēgā.
Recommended Posts