I\'ve already looked at other answers and I still feel that my question is relevant and deserves a separate entry.
I have a table named settings(which stores user se
How about:
$id = array();
$sql = "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
$sql .= "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
$sql .= "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
$sql .= "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
$sql .= "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
$sql .= "INSERT INTO `table` VALUES ('', 'foo', 'bar');";
if ($db=new mysqli('host', 'user', 'pass', 'dbase'))
{
$db->multi_query($sql);
if ( isset($db->insert_id) ) $id[] = $db->insert_id;
while ($db->more_results())
{
if ($db->next_result()) $id[] = $db->insert_id;
else trigger_error($db->error);
}
$db->close();
}
else trigger_error($db->error);
if (count($id) == 0) trigger_error('Uh oh! No inserts succeeded!');
else print_r($id);
Perhaps this would return your insert ids like you are wanting. I haven't tested it, but perhaps you could adapt it for your purpose and who knows it might actually work.