php - Get 100 entries with foreach every time -
I have 10,000 users in the database and I am planning to send them emails in bundles of 100. Basically I need to use it to get 100 users and send email, and then get the next 100 and send it and so on.
I have to use foreign experiment to limit what I have achieved to limit number 100. How to get the next 100. Code:
$ email_preliminary = $ this-> Db- & gt; Select ('email') - & gt; Receive ('user'); $ Email_raw = Array (); $ Counter = 0; Forex Currency ($ email_preliminary- & gt; Results () as the $ line): $ email_raw [] = $ row-> E-mail; $ Counter ++; If ($ counter == 99) {break; } Endaurach; Appreciated the advice. Thanks!
$ mail = array (); Forex Currency ($ email_preliminary- & gt; result () as $ line) {$ mail [] = $ line-> E-mail; } $ Tab = array_chunk ($ mail, 100); Foreign Currency ($ tab $ mail_lot) {$ mails_to_send = implode (',', $ mail_lot); // in Mail 1 @ test.com, mail2 @ test.com, mail 3 @ test.com ...} for 100 entries}
Comments
Post a Comment