in reply to Split and the tears it caused me.

Taking impossiblerobot's suggestion a step further: If what you need comes back in the first two columns of the result set you can get the best performance binding the result set directly to those variables. Put your bind after the execute() call:

$sth->execute(); $sth->bind_columns(\$req, \$ccode);

Then change your fetch to look like this:

while ($sth->fetch()) { print " $req $ccode\n"; }

For large result sets I've seen a measurable performance improvement binding directly to variables versus using a fetch that gets the results as an array or hash.