php - Coding error detected, it must be fixed by a programmer: insert_records() passed non-traversable object -


i want insert form data moodle db,

i have 2 table needs update every time im trying insert @ same time,

here code

$result = $db->update_record('newmodule', $newmodule);  if (!$db->get_record('newmodule1', array('course_id' => $newmodule->id))) {   //now need insert data db //object builder      foreach ($newmodule $key => $value) {          if($key == 'time' || $key == 'audio' || $key == 'entxt' || $key == 'fatxt' || $key == 'url'){             $new->$key = $value;         }elseif ($key == 'id') {             $new->course_id = $value;         }      } //just trying finding way           $result = $db->insert_records('newmodule1', $new);       } 

every time trying insert data getting this

coding error detected, must fixed programmer: insert_records() passed non-traversable object

how can split stdclass, insert each part db ?

ok found working solution,

        ($i=0; $i <=count($newmodule->time); $i++) {              $new->course_id = $newmodule->id;             $new->videourl  = $newmodule->url;             $new->audio     = $newmodule->audio[$i];             $new->time      = $newmodule->time[$i];             $new->entxt     = $newmodule->entxt[$i];             $new->fatxt     = $newmodule->fatxt[$i];             $db->insert_record('newmodule1', $new);              unset($new);         } 

all did read array object create new object submit db unset created object, thats

ps:lol got negative question, because 1 person dont know moodle !!! wow !


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -