【问题标题】:Warning: mysqli_stmt::bind_param()警告:mysqli_stmt::bind_param()
【发布时间】:2013-12-30 12:26:32
【问题描述】:

这里有什么问题?

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

【问题讨论】:

    标签: php mysqli


    【解决方案1】:

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

    这是你想要做的......

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-08
    • 2015-05-17
    相关资源
    最近更新 更多