我无法在名为bookedseattbl的表中插入多行。我正在使用foreach循环,但它只插入一行。第一个插入查询执行正常。
<?php
$seats=explode(',',$_SESSION['seats']);
mysqli_query($con, "INSERT INTO bookingtbl(UserId, DetailsId, Amount, PaymentStatus) VALUES ('$uid', (SELECT detailstbl.DetailsId FROMdetailstbl
JOIN movietbl ON detailstbl.MovieId=movietbl.id AND movietbl.id = '$movieid'
JOIN theatretbl ON detailstbl.TheatreId=theatretbl.TheatreId AND theatretbl.TheatreName LIKE '$theatre%'
JOIN timingtbl ON timingtbl.TimingId=detailstbl.TimingId AND timingtbl.Time = '$time'),'$amt',1)");
$a=mysqli_insert_id($con);
foreach ($seats as $x)
{
mysqli_query($con, "INSERT INTO bookedseattbl(BookingId, SeatId) VALUES ('$a', (SELECT * FROM seatstbl WHERE SeatNo='$x')))");
}
?>
如果我尝试在绝对值中放置一个绝对值,它会按预期执行,但只能在使用select查询时执行一次。