devi usare i cicli for:
OppureCodice PHP:$query = "INSERT INTO tabella (id) VALUES ";
for($i=1;i<=$quanti;i++)
{
$query .= "('$i')";
if($i<$quanti)
{
$query .= ", ";
}
}
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
Il secondo è più facile e comprensibile ma consuma più risorse del server dovendo fare una insert nel db per ogni elemento selezionato...Codice PHP:
for($i=1;i<=$quanti;i++)
{
$query = ""INSERT INTO tabella (id) VALUES ('$i')";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
}
P.S. $quanti è il valore selezionato dal form html

Rispondi quotando