1
我使用mysqli_stmt :: bind_param()時遇到問題。有人能幫我嗎? 警告:mysqli_stmt :: bind_param()[mysqli的-stmt.bind-PARAM]:在類型定義字符串元素數不匹配綁定變量的數...mysqli_stmt :: bind_param()類型定義字符串中元素的數量不匹配編號
我在PHP初學者。由於
public function init($cards,$table,$seats)
{
$operation = $this->operation($table, $seats);
return $this->insertCards($cards,$operation,count($cards));
}
public function operation($table, $seats)
{
$operation = "insert into ".$table."(";
$values = "(";
for($i = 0; $i<count($seats);$i++)
{
$operation .= " cardsSeat".$seats[$i].",";
$values .= "?,";
}
$values .= "?,?,?)";
$operation .= " flop, turn, river) values ".$values;
return $operation;
}
public function insertCards($cards, $operation, $x)
{
$insertCards = $this->spojenie->prepare($operation);
$refArray = array();
foreach($cards as $key => $value) $refArray[$key] = &$cards[$key];
call_user_func_array(array($insertCards, 'bind_param'), $refArray);
$insertCards->execute();
return true;
}
可能重複的[錯誤時結合PARAMS(PHP)](http://stackoverflow.com/questions/ 5131297 /錯誤 - 當結合-PARAMS-PHP) – deceze 2011-04-03 02:44:12