2

I have

$sql = 'INSERT INTO Events ('.$names.') VALUES ('.$values.')';
//$names - string of all row names, $value - very long string with values
mysqli_query($mysqli, $sql) or die ($sql);

And mostly it does work, however sometimes I get similar error

Warning: Error while sending QUERY packet. PID=10828 in /insert.php on line 107
INSERT INTO Events (work_hours, …) VALUES ('2015-06-28 11:00 (sekmadienis)', …)

Line 107 where mysqli_query is.
These … stand for my strings.

When I write all that $sql value directly to phpMyAdmin everything is OK — such query is inserted.

So my question is how to avoid that PID error and who causes it?

marian0
  • 3,336
  • 3
  • 27
  • 37

1 Answers1

0

This is an issue with the max_allowed_packet setting for MySQL. You need to increase the value.

You can set and check it's value by following this how to check and set max_allowed_packet mysql variable

Community
  • 1
  • 1
NIlesh Sharma
  • 5,445
  • 6
  • 36
  • 53