Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在数据库方面不是很强,所以如果问题是转储,请原谅。我需要处理大量数据。一次加载整个数据是很自然的。如何检索小尺寸(1、10 或 100)部分的行。顺便说一句,什么份量更好?
一次拉出一行数据可能是最简单的做事方式。PDO 使它变得非常简单:
<?php $sth = $dbh->prepare("SELECT name, colour FROM fruit"); $sth->execute(); while($result = $sth->fetch(PDO::FETCH_ASSOC)) { // Do stuff to process row. } ?>