spires Posted September 1, 2006 Share Posted September 1, 2006 Hi, Does any know how to add more than one row into your database at the same time?I'm guessing it would be some kind of four loop that keeps looping over the INSERT untillall the data is in.Any ideas please Quote Link to comment Share on other sites More sharing options...
pmeasham Posted September 1, 2006 Share Posted September 1, 2006 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.