Welcome Guest, Not a member yet? Register   Sign In
How to Insert auto multiple row in database
#1
Wink 

Please would you help me  How to Insert auto multiple row in database?
have tried but fail .
 
Reply
#2

Perhaps if you try explaining (in much more detail) what you're trying to do, we can help.
Reply
#3

PHP Code:
$data = array(
        array(
                
'title' => 'My title',
                
'name' => 'My Name',
                
'date' => 'My date'
        
),
        array(
                
'title' => 'Another title',
                
'name' => 'Another Name',
                
'date' => 'Another date'
        
)
);

$this->db->insert_batch('mytable'$data); 

Above from the docs.
https://www.codeigniter.com/user_guide/d...rting-data
(You have to scroll down a bit to the end of that section).

1. Get your data together however you want (from a form input, from a curl, from an admin screen etc)
2. Create your multi dimensional array.
3. Use update_batch to insert multiple rows.

Easy peasy. Lightweight. Fast. Powerful. Flexible. As most things CI are :-)

Hope that helps.

Paul.

PS You would get a more specific answer if you posted what you had "tried and failed". (What did you try? What did you expect? What did you get?)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB