I couldn\'t find a solution to this already on stackoverflow, most other related topics had to do with Apache not starting first and getting this error. My issue is that aft
FWIW, I had the same issue on a similar setup (Windows XP). The same code worked without this issue on Mac (OS X).
I resolved the issue by using a persistent connection within the MySQLi class.
See here for more information: http://php.net/mysqli.persistconns
Make sure you are aware of all the gotchas / caveats associated to using a persistent connection.