Jump to content

inputing multipul data at once into a database


spires

Recommended Posts

you can do this with sql:

INSERT INTO `table` VALUES ('data1a','data1b'),('data2a','data2b'),('data3a','data3b')

You can do this with php using multi database querys as well, however I'd look into using a database abstraction layer.
eg from pears:

[code]
$sth = $db->prepare('INSERT INTO numbers VALUES (?, ?, ?)');
$alldata = array(array(1, 'one', 'en'),
                array(2, 'two', 'to'),
                array(3, 'three', 'tre'),
                array(4, 'four', 'fire'));
$res =& $db->executeMultiple($sth, $alldata);
[/code]

see: http://pear.php.net/package/DB

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.