Can php PDO fetch two results sets? And If yes, what is better 1 result set or more than 1?
问题 If is posible, how can I fetch two results sets: $sth=$dbh->prepare("SELECT * FROM tb1 WHERE cond1; SELECT * from tb2 Where cond2"); $sth->execute(); $row=$sth->fetchAll(); print_r ($row); These are two completely different tables (no fiels in common). 回答1: Yes PDO can fetch two (or more) rowsets, as long as the database you are using supports it. I think MS SQL Server and MySQL both support this functionality, but at the time of writing SQLite does not. The function you want is PDOStatement: