ho risolto cosi
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html"> <title>list seller</title> <script type="text/javascript" src="js/Event.js"></script> <script type="text/javascript" src="js/SortedTable.js"></script></head><body> <div id="wrapper"> <table border="1" class="sorted" id="table" cellspacing="0" cellpadding="0" > <thead><tr> <th><b>ID</b></th> <td><b>AVVIA TRATTATIVA</b></td> <td><b>STATO TRATTATIVA</b></td> <th><b>USERNAME</b></th> <th><b>NAZIONALITA'</b></th> <th><b>CAMBIO EURO</b></th> <th><b>QUANTITA' DISPONIBILE PER LA VENDITA</b></th> <th><b>METODI DI PAGAMENTI ACCETTATI</b></th> <th><b>STATUS</b></th> </tr> </thead><tbody><?php session_start();require_once('lib/Users.class.php');$login = New Users;$login->access_denied();$db_username = $login->get_username();$attiva = "ATTIVA";
// includiamo il file di configurazione include "db_config_reload.php";
// seleziono i campi nelle varie tabelle$query = mysql_query("SELECT seller.id, seller.username, seller.change, seller.amount, seller.paymetod, users.nazionalita FROM seller, users WHERE seller.username = users.username AND seller.status_trattativa = 0") or die(mysql_error());
// scorro con un array la query e quindi i vari campi delle varie tabellewhile($row = mysql_fetch_array($query))
{
extract($row);
$table .= "<tr>"; $table .= (($i++)%2 == 0) ? "<tr style=\"background-color: #DDDDDD;\">" : "<tr style=\"background-color: #FFFFFF;\">"; $table .= "<form action=\"insert_ask.php\" method=\"post\">"; $table .= "<input type=\"hidden\" name=\"insert_ask\" value=\"{$id};{$change};{$amount};{$paymetod};{$username};{$db_username}\" /> "; $table .= "<td> {$id} </td>"; $table .= "<td> <input type=\"submit\" value=\"Avvia Trattativa\" onClick=\"return confirm('Trattativa id: $id, sicuro che è questa la trattativa che vuoi avviare?');\"/> </td>"; $table .= "</form>"; $table .= "<td> {$status_trattativa} {$attiva} </td>"; $table .= "<td> {$username} </td>"; $table .= "<td> {$nazionalita} </td>"; $table .= "<td> {$change} </td>"; $table .= "<td> {$amount} </td>"; $table .= "<td> {$paymetod} </td>";
if(mysql_num_rows(mysql_query("SELECT username FROM users_online WHERE username = '".$username."'")) > 0) { $table .= "<td> ONLINE </td>"; } else { $table .= "<td> OFFLINE </td>"; } $table .= "</tr>";
}
echo $table;?></tbody></table> </div> <script type="text/javascript">onload = function() {var table = new SortedTable();}</script></body></html>
ora se volessi fare in modo che mi escano le righe alternate una con colori differenti tramite javascipt?
io utilizzo il metodo con html che vedete sopra per averle ma ua volta che prova a mettere in ordine naturalmente non si ha piu l'effetto!