Good morning friends!!
I'm trying to insert data into two tables at the same time. The first condition IF is okay, but the second that is ELSE is not fine. I am including my insertion code below. I've tried it with ELSE, with ELSEIF even with the IF's, but it is not working.
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
if(visiting_club != '1'){
$panel = "INSERT INTO panel (GF, GC, binant_club, visitor_club, id_competitions, status, status)
VALUES ('$score1','$scor2','$mandant_club','$visitor_club',
'$id_competitions','$id_states','$situation')";
}else{
$panel = "INSERT INTO panel
(GC, GF, mandant_club, visitor_club,
id_competitions, status, status)
VALUES ('$score1','$scor2','$mandant_club',
'$visitor_club','$id_competitions',
'$id_states','$situation')";
}
Thank you all for your attention and suggestions.