Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How can insert values array as batch in database mysql?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34788
    binboy
    Participant

    For example i have following values and want insert batch they in database, How is it?(can done it with foreach and codeigniter)

    My values:




















    insert batch in database as:

    http://i.imgur.com/H6EDa.png

    #89148
    binboy
    Participant

    no. this php code not set with my values. I want insert to values(in the first my post) as: http://i.imgur.com/H6EDa.png

    How should change html code(can not change input value) and what use in php code?

    My code is this but not work:


    $u_id = $this->input->post('u_id');
    $un = $this->input->post('un');
    $up = $this->input->post('up');
    $ue = $this->input->post('ue');

    $data = array();
    foreach ($un as $idx => $name) {
    $data[] = array(
    'u_id' => $u_id[$idx],
    'un' => $un[$idx],
    'up' => $up[$idx],
    'ue' => $ue[$idx],
    );
    };
    $this -> db -> insert_batch('units', $data);

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.