简体   繁体   中英

Warning: mysqli_stmt::bind_param()

What is the problem here?

$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);

The error is: Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variable

You're not using the method properly, just look at the signature (as shown on the doc pages ):

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

The first argument should be a string, indicating what types the actual params are... In your case, I'd guess something like:

$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);

Is what you're trying to do...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM