我试图同时将数据插入两个表中。第一个条件 IF 可以,但第二个条件 ELSE 不行。我在下面添加了我的插入代码。我已经尝试过使用 ELSE、ELSEIF 甚至 IF,但它不起作用。
if (isset($_POST['save')) {
if (@$_POST['id_confrontations'] == "") {
@$description = $_POST['description'];
@$dt_confrontation = $_POST['dt_confrontation'];
@$id_competitions = $_POST['id_competitions'];
@$id_stages = $_POST['id_stages'];
@$score1 = $_POST['score1'];
@$score2 = $_POST['score2'];
@$mandant_club = $_POST['mandant_club'];
@$visitor club = $_POST['visitor_club'];
@$situation = $_POST['situation'];
@$phase = $_POST['phase'];
@$id_trainers = $_POST['id_trainers'];
@$history = $_POST['history'];
//saves the record in the "confrontations" table - In this case insertion is perfect
$confrontations = "INSERT INTO confrontations
(description, dt_confrontation, id_competitions,
stadiums_id, score1, scoring2, binder_club,
situation, stage, id_trainers, history)
VALUES ('$description','$dt_confrontation','$id_competitions',
'$id_estadios','$score1','$score2',
'$mandant_club','$visitor_club','$situation',
'$stage','$id_trainers','$historia')';
//saves the record in the "panel" table - In IF insertion is perfect, but in ELSE it inserts as if it were IF
//In the IF rule the mandating_club would be == '1', so the GF would receive the score1 and the GC would receive the score2
//In the ELSE rule the visiting_club would be == '1', so the GC would receive the score1 and the GF would receive the score2
感谢大家的关注和建议。
白衣非少年