我正在尝试创建一个循环,将我想要的值插入到 MySQL 数据库中,这个循环插入正确的值,但在不同的行上。if($qa != "Sallader"){ $query = "ALTER TABLE bestallningar2 ADD ".$qa."1 int, ADD ".$qa."2 int, ADD ".$qa."3 int, ADD ".$qa."4 int, ADD ".$qa."5 int;"; $result = mysqli_query($connection, $query); $x1 = $_SESSION["".$qa."1"]; $x2 = $_SESSION["".$qa."2"]; $x3 = $_SESSION["".$qa."3"]; $x4 = $_SESSION["".$qa."4"]; $x5 = $_SESSION["".$qa."5"]; $query2 = "INSERT INTO bestallningar2 (".$qa."1, ".$qa."2, ".$qa."3, ".$qa."4, ".$qa."5) VALUES('$x1', '$x2', '$x3', '$x4', '$x5');"; $result = mysqli_query($connection, $query2);如前所述,我希望它将所有值插入到同一行中,但事实并非如此。真的不知道该怎么做,提前谢谢!
- 2 回答
- 0 关注
- 719 浏览
添加回答
举报
0/150
提交
取消