Mailinglisten-Archive |
> Warum funktioniert folgende FOR-Schleife nicht?
>
> for($i=0; $i <= 2; $i++) {
> $querytab2 = "INSERT proto_eintraege (protokoll_id, top_id, top, text)";
> $querytab2 .= "VALUES ('$nr_id', '$i', '$top[$i]', '$toptext[$i]')";
> mysql_query($querytab2,$conn);
> }
ich weiss zwar nicht warum, aber ein hinweis
zu deinem so schlechten code ;-)
einfach umgebaut geht das schon viel schneller:
$sql = array();
for($i=0; $i <= 2; $i++) {
$sql[] = '(\''.$nr_id.'\', \''.$i.'\', \''.$top[$i].'\', \''.$toptext[$i].'\')';
}
mysql_query('INSERT proto_eintraege (protokoll_id, top_id, top, text)
VALUES '.implode(',',$sql),$conn);
kiri
________________
8307 305 165 1781
php::bar PHP Wiki - Listenarchive