鍍金池/ 問答/PHP  數(shù)據(jù)庫(kù)/ MySQL PHP 如何分批量的從數(shù)據(jù)庫(kù)循環(huán)讀取數(shù)據(jù)?

MySQL PHP 如何分批量的從數(shù)據(jù)庫(kù)循環(huán)讀取數(shù)據(jù)?

假如每次從數(shù)據(jù)庫(kù)讀取五條,該怎么一直讓程序循環(huán)下去,直到全都循環(huán)完成。
加個(gè)

$a = true;
//然后用while循環(huán)
//在數(shù)據(jù)庫(kù)里設(shè)計(jì)個(gè)字段,為判斷有沒有取出來過這條數(shù)據(jù)的字段,默認(rèn)為沒取出來過
//然后用foreach把每次取出來的每條數(shù)據(jù)都標(biāo)記為已取出過,直到所有數(shù)據(jù)都被標(biāo)記為已取出過來,循環(huán)停止。

這樣的邏輯對(duì)嗎?

回答
編輯回答
墻頭草

For example, I want to use a loop: when a user enters a name ( skyped, clicker heroes games,..jany..) , he or she will export the corresponding hotmail ( clickerheroes@hotmail.com)

2018年5月19日 14:28
編輯回答
萌小萌

I will suggest you using a Loop when enters the name. Make sure to use ForEach Loop. Moreover let me tell you that you can Check Chase Verify.

2017年4月18日 22:17
編輯回答
別傷我

thank you you can visit my site for more information
鏈接描述

2017年12月8日 18:48
編輯回答
孤島

Thanks for the comments. It's hard to work on PHP. I started my Oscar portal on Wordpress and no its getting difficult to carry on.

2018年3月21日 14:55
編輯回答
乖乖噠

Visit my site you will have more useful information. http://howtoget.wiki/category...

2017年11月26日 19:03
編輯回答
愿如初

WordPress uses PHP, with SQL queries in PHP markup to store and export data from MySQL databases. For example, if you are a member of a site that uses WordPress's management system, SQL is used to log in, obtain a membership ID, verify that you have an active membership, and ensure that the front-end is displaying. Correct profile data.
PHP and SQL work in parallel in WordPress, helping you create dynamic content based on a variety of factors, such as your IDs and user roles. This allows you to do many things like hiding or show content to specific users, like admins, editors or subscribers. These tasks can not be completed if SQL and MySQL.
192.168.1.1

2018年3月17日 01:37
編輯回答
艷骨

你用limit呀。然后記錄id,直到id大于maxid不就可以了么???

2017年2月26日 19:38
編輯回答
陌顏

可以用分頁查詢的原理啊。。

$count = '100';//總條數(shù)
$strip = 0;
$num = $count/5;//循環(huán)多少次
for($i=1;$i<=$num;$i++)
{
 $sql = "select * from `table` order by id limit ".$strip.",5";
 $strip += 5;
}
2017年11月20日 06:58
編輯回答
哚蕾咪

我在想,用foreach while循環(huán),和一次性查能有多少性能差異? 多次查詢數(shù)據(jù)庫(kù),不如一次查出來?

2017年11月20日 10:38
編輯回答
賤人曾

最好for循環(huán)里面sleep下,讓cpu休息一下

2017年7月9日 10:27