Proper MySQLi parameterized query syntax from http://php.net/manual/en/mysqli.quickstart.prepared-statements.php:
$stmt = $mysqli->prepare("INSERT INTO test(id) VALUES (?)");
$stmt->bind_param("i", $id);
But never something like:
$stmt = $mysqli->prepare("INSERT INTO test(id) VALUES (:id_value)");
$stmt->bind_param("i", "id_value", $id);
It appears to me that named parameter
substitution is a reasonable feature to be implemented at the API level. I am surprised that MySQLi only implemented unnamed parameters
in the library.
Is there a valid reason? It doesn't make sense to me, seeing how PDO, DQL, ORM all have adopted named parameters in their queries.
I hope it was not the case of "We were lazy & don't wanna" on the part of MySQLi developers. I believe there must've been a good reason and I am looking for that reason, or a way to seek out that reason. The reason for named parameters not being implemented in MySQLi extensions library.