php - Codeigniter when to use insert_batch() -
i'm developing mailing queue in codeigniter sends 100 messages @ time. i'm searching best way , came across $this->db->insert_batch(). looks useful can't find information on when or how use it. has used mailing purposes?
$data = array( array( 'title' => 'my title' , 'name' => 'my name' , 'date' => 'my date' ), array( 'title' => 'another title' , 'name' => 'another name' , 'date' => 'another date' ) ); $this->db->insert_batch('mytable', $data); // produces: insert mytable (title, name, date) values ('my title', 'my name', 'my date'), ('another title', 'another name', 'another date')
you can't use $this->db->insert_batch() emailing purposes (obviously) because it's used insert data database. can use codeigniter email class instead.
$this->load->library('email'); $this->email->from('your@email.tld', 'your name'); $this->email->to('your@email.tld'); // send email see how looks $this->email->bcc('...'); // pass in comma-delimited list of email addresses or array $this->email->subject('email test'); $this->email->message('testing email class.'); $this->email->send(); in opinion, best way send email lot of users using codeigniter.
Comments
Post a Comment