Note that both examples (1505 and 1506) contain code that could tie up the server for a long time; the calls to printf() can block, although in these particular cases it seems extremely unlikely that the output (the names of five cities) would be sufficient to fill the output buffers. Still, I would probably avoid mixing mysqli_use_result with socket-based I/O.
