微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-警告: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]:类型定义字符串中的元素数量与绑定变量的数量不匹配

解决方法:

您没有正确使用该方法,仅查看签名(如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);

这就是你想要做的…

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐