RedBean batch insert in mysql

How to execute the following sql RedBean ?

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); 

Should I use batch insert loop support or RedBean?

+1
source share
2 answers

The creator of RedBeanPHP is here.

It is not supported by RedBeanPHP. You will have to use plain old SQL for this.

+5
source

What about sampling logic ?:

  $list = array(1, 2, 3, 4, 5, 6, 7, 8, 9); $beans = R::dispense('table', count($list)); for($i=0; $i<count($list)/3; $i++) { $beans[$i]->a = $list[$i*3+1]; $beans[$i]->b = $list[$i*3+2]; $beans[$i]->c = $list[$i*3+3]; } R::storeAll($beans); 
+1
source

Source: https://habr.com/ru/post/1438467/


All Articles