I need to create a PHP loop which will update a MySQL db for each iteration of the loop. This isn't a problem. But what I'd also like to do after each record is inserted is call a JavaScript function. I thought about echoing <script ...> and calling the function that way, but that means that for each iteration of the loop (and there could be 1000's or iterations) that a new <script line would be gererated so making the file very big. I can't use Header: Location because then the PHP would no longer be processed anymore. So does anybody have any other ideas?