I need to query mysql db with about 3000 queries, instead sending each query to db server, I create the huge query of INSERT INTO ON DUPLICATE KEY statements and send it to the db server. I found mysqli’s multi_query very usefull but then I need to insert into 5 different tables, each of about 3000 queries. Therefore I use this code:
$this->_mysqli->multi_query($values[1]);
while ($this->_mysqli->next_result()) {;}
$this->_mysqli->multi_query($values[2]);
while ($this->_mysqli->next_result()) {;}
$this->_mysqli->multi_query($values[3]);
while ($this->_mysqli->next_result()) {;}
$this->_mysqli->multi_query($values[4]);
while ($this->_mysqli->next_result()) {;}
$this->_mysqli->multi_query($values[5]);
while ($this->_mysqli->next_result()) {;}
But only first statement passes others wont. Any ideas why?
EDIT: if I add or die() I get this message MySQL server has gone away
Probably, the packet is too large.