MySQLi 용 래퍼 클래스를 작성하고 있습니다. 거기에서, 나는 질의와 변수 번호를 받아들이는 함수를 작성한다. mysqli_stmt::bind_param
. 나는이 코드를 실행하면mysqli_stmt 객체에서 call_user_func_array를 사용할 수 없습니다.
<?php
$db = new DbHelper();
$params = array('i', $stateID);
$result = $db->Execute('SELECT * FROM mst_cities WHERE State_ID = ?', $params);
?>
, 나는이 같은 경고를 얻을 : 여기
<?php
class DbHelper {
....
public function Execute($query, $params){
$this->open(); # Opens a connection to the database using MySQLi API
$stmt = $this->mysqli->prepare($query);
try{
$result = call_user_func_array(array($stmt, 'bind_param'), $params);
}
catch(Exception $ex){
# Handle Exception
}
}
....
}
?>
I 함수 호출 오전 방법은 다음과 같습니다 여기에 코드가
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in......
을 내가 뭘해야 해야 할 것? docs 가입일
댄 감사합니다. 그게 효과가 있었어. –
@ kush.impetus 당신은 그때 받아 들일 자유입니다 :) –
또 다른 문제. '$ stmt-> execute(); 사용하기. $ meta = 'result_metadata();'그리고 $ meta ['num_rows ']'를 echo하는 것은 0을 반환하고'$ this-> mysqli-> affected_rows'를 echo하면 -1이 반환됩니다. 그렇지 않으면 쿼리를 직접 사용할 때 제대로 작동합니다. 무엇이 문제 일 수 있습니까? –