File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -538,7 +538,27 @@ public function toLower($record) {
538538 }
539539 return $ out ;
540540 }
541-
541+
542+ public function insertFromArray ($ tablename , $ data ) {
543+ if (!is_array ($ data )) return false ;
544+
545+ $ k_query = '' ;
546+ $ v_query = '' ;
547+
548+ $ params = array ($ tablename );
549+ $ v_params = array ();
550+
551+ foreach ($ data as $ key => $ value ) {
552+ $ k_query .= ($ k_query != '' ? ', ' : '' ) . '?? ' ;
553+ $ v_query .= ($ v_query != '' ? ', ' : '' ) . '? ' ;
554+ $ params [] = $ key ;
555+ $ v_params [] = $ value ;
556+ }
557+
558+ $ query = 'INSERT INTO ?? ( ' . $ k_query . ') VALUES ( ' . $ v_query . ') ' ;
559+ return $ this ->query ($ query , true , $ params + $ v_params );
560+ }
561+
542562 public function diffrec ($ record_old , $ record_new ) {
543563 $ diffrec_full = array ();
544564 $ diff_num = 0 ;
You can’t perform that action at this time.
0 commit comments