While I was looking for a specific Mysqli answer, did I find that everyone refers only to PDO, thereby not addressing the problem with ? placeholder.
So, here I am publishing my contribution of a simple function to replace all parameters ? for parameters. (Php 7)
function addParamsToSQL ( string $SQL, array $params ) : string { foreach($params as $value) $SQL = preg_replace ( '[\?]' , "'" . $value . "'" , $SQL, 1 ); return $SQL; }
source share