Although I haven't tested it completely, I believe I've found a solution to this problem at http://orensol.com/2009/04/20/connecting-several-php-processes-to-the-same-mysql-transaction/
The DBHandler Class allows you to use one db connection for all the children, one initiated by the parent. It has queuing so running queries at the same time is not a problem.
A few edits I had to do:
1) In the query function
if (!$this->result)
throw new Exception ('Could not query: {' . $sql . '}. MySQL error was: '. mysql_error());
That throws an exception if the select statement returns nothing. Unnecessary.
Changed to:
if (!$this->result)
$this->exitSemaphore();
return;
2) In the "// SELECT etc..., we have a result set" block you can see the select statement's work. Right after that query I inserted an update to the table showing that no work is needed. This is of course a false statement as work is not finished, a child is working on it. However, it prevents children doing the same computing.
I created another mysql connection in the background to do the updating. As work is done before the Semaphore (?) is exited, other queries wait a bit. Updating using the class's connection could cause problems.