这里有什么问题?
$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]:类型定义字符串中的元素数与绑定变量数不匹配
答案 0 :(得分:2)
您没有正确使用该方法,只需查看签名(如the doc pages所示):
bool mysqli_stmt::bind_param ( string $types , mixed &$var1 [, mixed &$... ] )
第一个参数应该是一个字符串,表示实际参数的类型......在你的情况下,我猜是这样的:
$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);
你正在尝试做什么......