$DB->count_records
$count = $DB->count_records('autoattend_sessions', array('courseid'=>$course->id, 'sessdate'=>$sdate, 'starttime'=>$starttime));
$DB->insert_record
- record_id insert_record($table, $dataobject, $returnid=true, $bulk=false);
$apply_id = $DB->insert_record('apply', $apply);
$DB->update_record
- bool update_record($table, $dataobject, $bulk=false);
update_record('apply', $apply);
$DB->delete_records
- bool delete_records($table, array $conditions=null)
$ret = $DB->delete_records('event', array('modulename'=>'apply', 'instance'=>$apply_id));
$DB->get_record
- object get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING)
$item = $DB->get_record('apply_item', array('id'=>$apply_id)); $name = $item->name;
$DB->get_records
- array(object) get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
$params = array('apply_id'=>$item->apply_id); $items = $DB->get_records('apply_item', $params, 'position'); foreach ($items as $item) { $name = $item->name; ......
$DB->get_records_select
- array(object) get_records_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
- $select の ? に 配列 $params の要素が対応(並び順)
- $select 中の :変数名 に $params の各要素が対応
- name が結果の配列のキーになる(重複があるとワーニング)
$templates = $DB->get_records_select('apply_template', 'course=? OR ispublic=1', array($course->id), 'name');
$DB->get_records_sql
- array(object) get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0)
- $sql の ? に 配列 $params の要素が対応(並び順)
- $sql 中の :変数名 に $params の各要素が対応
$where = 'WHERE as.id=av.submit_id AND av.version=0 AND as.apply_id=:apply_id AND ai.id=av.item_id '; $sql = 'SELECT MAX(ai.position) FROM {apply_submit} as, {apply_value} av, {apply_item} ai '.$where; $params = array(); $params['apply_id'] = $apply_id; $lastpos = $DB->get_field_sql($sql, $params);
Counter: 467,
today: 1,
yesterday: 0
最終更新: 2021-07-29 (木) 14:37:32 (JST) (1228d) by iseki