• 常用代码(3.0)


    获取数据
    $table = $this -> t_news_inst . ' ni,' . $this -> t_sc_user . ' su';
    $fields = 'ni.id,su.pic_url,su.name,ni.create_time,ni.send_state,ni.news_title,ni.news_describe,ni.image_info';
    $cond = array(
    'ni.id=' => intval($id),
    'ni.info_state=' => $this -> info_state,
    '^ni.send_user_id=' => 'su.id',
    'ni.own_user_id REGEXP ' => '(0|' . $this -> user_id . ')',
    'ni.news_title like' => '%' . $condition['keyword'] . '%',
    'ni.json_data like' => '%"' . $this -> user_id . '"%',
    'na.audit_state IN' => array(1,2),
    );
    $ret = $this -> pkg_db -> select($table, $fields, $cond);
    !is_array($ret) && $ret = array();
    return $ret;
     
    批量导入数据

    // 字段要是数组
    $fields = array(
    'com_id','form_id','formsetinst_id','work_node_id',
    'work_id','assign_id','assign_content','assign_time',
    'be_assign_id','create_time',
    );
    $data = array();
    foreach ($be_assign_id_arr as $v) {
    $tmp_data = array(
    'com_id' => $this -> com_id,
    'form_id' => $form_id,
    'formsetinst_id' => $formsetinst_id,
    'work_node_id' => $work_node_id,
    'work_id' => $work_id,
    'assign_id' => $assign_id,
    'assign_content' => $assign_content,
    'assign_time' => $assign_time,
    'be_assign_id' => intval($v),
    'create_time' => $create_time,
    );
    $data[] = $tmp_data;
    }
    $ret = $this -> pkg_db -> batch_insert($this -> t_assign, $fields, $data);

  • 相关阅读:
    python-文件操作
    python之-字符编码
    课程总结
    IO流文件输出流的应用
    字符串的基本操作
    数据结构字符串实训报告
    窗口的切换
    事件处理
    Java异常处理
    二维数组实现转置
  • 原文地址:https://www.cnblogs.com/phonecom/p/6759964.html
Copyright © 2020-2023  润新知