try this query instead, should be WAY faster... only hits MySQL once with a large insert
(note: that last substr just removes the trailing "," from the query so its valid)
Code:
$dbcnx = mysql_connect('localhost','xxxxx', 'xxxxx');
mysql_select_db("testtable", $dbcnx);
$query = "";
for ($i = 10000; $i <= 20000; $i++) {
$query = $query . "('" . $i . "'),";
}
$query = "insert into users (muser) values " . substr($query, 0, strlen($query) - 1);
mysql_query($query);
i think thats right, but you get the idea... you can do multiple inserts in one query w/ MySQL so handle the processing beforehand and eliminate all the redundant connections, etc.