I am creating custom tables from a plugin. Foreign keys are required. To be safe, I'm want turn off foreign_keys_check before issuing maybe_create_table().
This codes is what I have to check variable's initial status, make the change and, and show the result:
echo $wpdb->query( "SHOW VARIABLES LIKE '%foreign%'" );
$wpdb->query( 'SET foreign_key_checks=0' );
echo $wpdb->query( "SHOW VARIABLES LIKE '%foreign%'" );
I expected the output to be 10 reflecting that the SET succeeded. Instead, I get 11 indicating the foreign_key_checks variable remains true.
What is the proper way to programmatically set a MySQL variable from inside WordPress?