If you are using PostgreSQL, the following will improve your execution speed... I've seen results 2-3 times faster.
<?
$sql="insert into table (field) values ('some stuff');
$conn=pg_connect('dbase=yourdb user=youruser password=yourpassword');
pg_exec($conn, "begin transaction");
for ($i=0; $i<100; $i++)
pg_exec($conn, $sql);
pg_exec($conn, "commit");
?>
In PG, changes transactioned together happen much more rapidly than individual statements (which are themselves transactioned with a commit of a single entry)
MySQL supports transactions, but I don't know the implications thereof. Hope this helps.