$p1fname=trim($_POST['p1fname']);
$p1lname=trim($_POST['p1lname']);
$p1email=trim($_POST['p1email']);
$p1ahe=trim($_POST['p1age']);
$p2fname=trim($_POST['p2fname']);
$p2lname=trim($_POST['p2lname']);
$p2age=trim($_POST['p2age']);
$p2email=trim($_POST['p2email']);
$player="INSERT INTO player (team_id, first_name, last_name, age, email)VALUES(?, ?, ?, ?, ?), (?, ?, ?, ?, ?)";
$playerquery=$db->prepare($player);
$p = $playerquery->bind_param('issisissis', $team_id, $p1fname, $p1lname, $p1age, $p1email, $team_id, $p2fname, $p2lname, $p2age, $p2email);
if($p){
$playerquery->execute();
echo 'player record added ---';
}
else{
echo 'player record not added---';
}
答案 0 :(得分:0)
将'ssssss'替换为'sssss'
在上面的例子中,你在参数
中再添加一个's'此外,
将“d”用于数字,将“f”用于浮点数或双值
答案 1 :(得分:0)
您尝试添加6个参数。只需要5个参数。
本节:
$q = $query->bind_param('ssssss', $name, $cfname, $clname, $phone, $email, $tc);
试试这个:
$q = $query->bind_param('sssss', $name, $cfname, $clname, $phone, $email);
答案 2 :(得分:0)
$q = $query->bind_param('ssssss', $name, $cfname, $clname, $phone, $email, $tc);
在上面的例子中,你已经传递了$ tc,你没有在插入查询中使用它。请检查。