In questo esempio $query2 recupera il campo della tabella che contiene le caratteristiche, cioè una stringa del tipo 1-2-4-5 ecc. Fammi sapere.
codice:$query = mysql_query("SELECT * FROM particolarita ORDER BY id") or die(mysql_error()); $query2 = mysql_query("SELECT caratteristiche FROM automobili where id_auto = 1") or die(mysql_error()); $row = mysql_fetch_assoc($query2); while ($row2 = mysql_fetch_assoc($query)) { echo $row2['nome']; ?> <input type="checkbox" name="particolarita[]" value="<?php echo $row2['id'] ?>" <?php echo strpos($row['caratteristiche'],"$row2[id]") === false ? '' : 'checked' ?> /> <?php } ?>

Rispondi quotando