2013-12-12 31 views
1

這裏有什麼問題?警告:mysqli_stmt :: bind_param()

$stmt =$con->prepare("INSERT INTO tcp (capture_order, from_ip, to_ip, from_port, to_port, tcp_length, tcp_stream, tcp_stream_text, tcp_sequence_dec) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); 

$stmt->bind_param( $this->capture_order,$this->from_ip, $this->to_ip,  $this->from_port,$this->to_port, $this->tcp_length,$this->tcp_stream,  $this->tcp_stream_text, $this->tcp_sequence_dec); 

的錯誤是: 警告:mysqli_stmt :: bind_param()[mysqli的-stmt.bind-PARAM]:在類型定義串的元素數量不匹配綁定變量

回答

2

您的數又不是使用方法正確,就看簽名(如圖所示的the doc pages):

bool mysqli_stmt::bind_param (string $types , mixed &$var1 [, mixed &$... ]) 

第一個參數應該是一個字符串,表示實際PARAMS是什麼類型的?你的情況,我我猜想是這樣的:

$stmt->bind_param('issiiiiss', $this->capture_order,$this->from_ip, $this->to_ip,  $this->from_port,$this->to_port, $this->tcp_length,$this->tcp_stream, $this->tcp_stream_text, $this->tcp_sequence_dec); 

是你想要做什麼......

+0

THANK YOU!我認爲第一個參數只是一個字符串!現在我懂了!!!!! – Tigran

+0

@Tigran:很高興爲您服務。只是一個友好的說明:在幫助部分,它聲明[_「請不要添加評論您的問題或回答說」謝謝「_](http://stackoverflow.com/help/someone-answers ),相反,我們鼓勵您接受解決您問題的答案 –

相關問題