I stumbled across this link on my travels and it helped quite a bit in sriting some small piece of benchmarking MySQL with PHP. I took the code and replaced it into my own script that wrote to a database and then read from it. It needed one small change to make it work for me, I needed to add in:
$res = array();
Here is the link:
http://3rdmover.com/mysql-debugging-in-php
