title: How to change SQL_MODE and FOREIGN_KEY_CHECKS after connection using PHP and MySQLi?
body: <p>I'm using PHP with OO MySQLi. The connection has already been opened but now I need to disable FOREIGN_KEY_CHECKS and set SQL_MODE. Then I need to renable the FOREIGN_KEY_CHECKS after a series of scripts.</p>
  
  <p>If I did it all in MySQL, it would look like this:</p>
  
  <pre><code>INSERT INTO my_table VALUES ('foreign', 'key', 'violation'); -- prevented
  
  SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO';
  SET foreign_key_checks = 0;
  INSERT INTO my_table VALUES ('foreign', 'key', 'violation'); -- allowed
  SET foreign_key_checks = 1;
  
  INSERT INTO my_table VALUES ('foreign', 'key', 'violation'); -- prevented
  </code></pre>