The PHP documentation for 'execute' includes the example #2 (https://www.php.net/manual/en/mysqli-stmt.execute.php#example-1489) that looks like this :
$stmt = $mysqli->prepare('INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)');
$stmt->execute( ['Stuttgart', 'DEU', 'Baden-Wuerttemberg'] );
Notice there is no stmt->bind_param, the values are added as an array parameter of execute.
I tried to make this example to work by creating the table and running the code :
CREATE TABLE myCity
(
Name VARCHAR(99),
CountryCode VARCHAR(99),
District VARCHAR(99)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_UNICODE_CI
But it didn't work, nothing was inserted and there was no error message or warning. I also tried using variables instead of static values as parameters of execute but didn't work either.
Am I missing something? Did I misinterpret the example? So is bind_param necessary and execute should not get the values to insert?
I am using PHP version 7.2.18.