Quindi non è detto che questo sistema sia più rapido di :
Codice PHP:
$query_categoria = "SELECT * FROM " . $table_categorie . " ORDER BY categoria";
$result_categoria = mysql_query($query_categoria);
$num_rows_categoria = mysql_num_rows($result_categoria);
for($i = 0; $i < $num_rows_categoria; $i++)
{ $rowcategoria = mysql_fetch_array($result_categoria);
$return .= "[b]" . $rowcategoria['categoria'] . "(" . $rowcategoria['categoria_id'] . ")" . "
[/b]";
$query_sottocategoria = "SELECT * FROM " . $table_sottocat . " WHERE categoria_id='" . $rowcategoria['categoria_id'] . "' ORDER BY sottocat";
$result_sottocategoria = mysql_query($query_sottocategoria);
$num_rows_sottocategoria = mysql_num_rows($result_sottocategoria);
for($l = 0; $l < $num_rows_sottocategoria; $l++)
{ $rowsottocategoria = mysql_fetch_array($result_sottocategoria);
$return .= "[i]" . $rowsottocategoria['sottocat'] . "(" . $rowsottocategoria['sottocat_id'] . ")" . "
[/i]";
$query_marca = "SELECT * FROM " . $table_marche;
$result_marca = mysql_query($query_marca);
$num_rows_marca = mysql_num_rows($result_marca);
for($k = 0; $k < $num_rows_marca; $k++)
{ $rowmarca = mysql_fetch_array($result_marca);
$query_prodotto = "SELECT * FROM " . $table_prodotti . " WHERE sottocat_id='" . $rowsottocategoria['sottocat_id'] . "' AND marca_id='" . $rowmarca['marca_id'] . "'";
$result_prodotto = mysql_query($query_prodotto);
$num_rows_prodotto = mysql_num_rows($result_prodotto);
if($num_rows_prodotto != 0){
$return .= "[b][i]" . $rowmarca['marca'] . "[/i][/b][i][/i]
";
for($j = 0; $j < $num_rows_prodotto; $j++)
{ $rowprodotto = mysql_fetch_array($result_prodotto);
$return .= "" . $rowprodotto['prodotto'] . "(" . $rowprodotto['prodotto_id'] . ")" . "
";
}
}
}
}
}
O sbaglio? Ci sono altri metodi ancora per eseguire queste operazioni?
Grazie delle info!!