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
  • #34788

    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:


    no. this php code not set with my values. I want insert to values(in the first my post) as:

    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.