Я пытаюсь использовать call_user_func_array и mysqli_stmt :: bind_param как так:Mysqli bind_params для вставки запроса
# A. prepare an insert query statement
$this->_stmt = $db_link->prepare('INSERT INTO foo (col1, col2) VALUES (?,?)');
# B. bind a placeholder array to the statement
$bound = array('col1' => null, 'col2' => null);
call_user_func_array(array($this->_stmt, 'bind_param'),
array($types_string, &$bound));
# C. while there are records, retrieve, munge, and insert
while ($row = $res->fetch_assoc()) {
$bound = transform($row); # $bound remains an array indexed as 'col1', 'col2'
$this->_stmt->execute(); # PHP Notice: Array to string conversion
}
Я путаюсь ссылками PHP, что приводит к массиву для преобразования строки. Либо я не привязываю массив заполнителей правильно к шагу B, либо я не правильно назначаю местозаполнитель на этапе C.
(Подобные вопросы были заданы раньше, но я не нашел ответа на мой .)