我有一个用户列表,需要使用foreach循环进行迭代,并插入到db表中每个新行的表中.
$data['entity_classid'] = $classid;
$data['notification_context_id'] = $context_id;
$data['entity_id'] = $entity_id;
$data['notification_by'] = $userid;
$data['actionid'] = $actionid;
$data['is_read'] = 0;
$data['createdtime'] = time();
foreach($classassocusers as $users){
$data['notification_to'] = $users->userid;
$DB->insert_record('homework.comments',$data,false);
}
Run Code Online (Sandbox Code Playgroud)
所以使用上面给出的插入查询是
谢谢