My favorites | Sign in
Project Home Downloads Wiki Source
Search
for
InsertingData  

Featured
Updated Oct 30, 2008 by tewo...@gmail.com

Inserting data into a table

Introduction

Once you have created a valid table object you can insert or update data into the table.

Details

Data to be inserted

/**
 * The example below relies on the following data from the table tbl_animals
 * ID       NAME        TYPE        LIFESPAN
 * 1        dog         mammal      12
 * 2        cat         mammal      30
 * 3        parrot      bird        60
 * 4        shark       fish        30
 * 5        dolphin     mammal      50
 * 6        crocodile   reptile     50
 * 7        snake       reptile     20
 * 8        spider      arachnid    1
 * 9        housefly    insect      1
 * 10       ostrich     bird        35
 * 11       bat         mammal      6
 * 12   

Insert multiple rows at once

$data = array(
            array(1,'dog','mammal',12),
            array(2,'cat','mammal',30),
            array(3,'parrot','bird',60),
            array(4,'shark','fish',30),
            array(5,'dolphin','mammal',50),
            array(6,'crocodile','reptile',50),
            array(7,'snake','reptile',20),
            array(8,'spider','arachnid',1),
            array(9,'housefly','insect',1),
            array(10,'ostrich','bird',35),
            array(11,'bat','mammal',6),
            array(12,'human','mammal',100)
            );
$browser->insertRows(array('id', 'name','type','lifespan'), $data);

Sign in to add a comment
Powered by Google Project Hosting