// prepare and bind
您好,
尝试通过预准备语句执行查询时收到以下错误:
Number of elements in string doesn't match number of bind variables
代码如下:
$track = $con->prepare("INSERT INTO resources_record (name,email,stage,format,topic,max_cost,mentor,total_cost,duration)
VALUES ('?', '?', '?', '?', '?', '?', '?', '?', '?')");
$track->bind_param($fullName, $email, $stage, $format, $topic, $cost, $mentor, $price, $duration);
// Execute
$track->execute();
$track->close();
答案 0 :(得分:1)
这里有两个明显的错误:
// allow selection of individual cells (instead of entire rows):
tableView.getSelectionModel().setCellSelectionEnabled(true);
// allow selection of multiple cells at once:
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
的第一个参数应该是一个字符串,用于标识后续参数的数据类型 - PHP Docs bind_param()
一个包含9 $track = $con->prepare("INSERT INTO resources_record (name,email,stage,format,topic,max_cost,mentor,total_cost,duration)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$track->bind_param('sssssssss', $fullName, $email, $stage, $format, $topic, $cost, $mentor, $price, $duration);
的字符串,因为你有9个参数,而且都是字符串(s
)值