Let's say I have something like this:
$db=new PDO($dsn);
$statement=$db->query('Select * from foo');
while ($result=$statement->fetch())
{
//do something with $result
}
How would I put another query inside of that while loop? Even if I make a new PDOStatement object, it seems that that overwrites the cursor for the topmost PDO statement. The only other solution I see is to either a) fetch the entire outer loop at once or b) open 2 different connections to the database. Neither of these seem like a good idea, are there any other solutions?