The code is as follows, it is for a university project, I am making a cup model and I am inserting matches and I need to validate that the two selections are from the same group, here the code but does not work
<?php
require_once 'conexion.php';
$seleccion1 = $_GET['Seleccion1'];
$seleccion2 = $_GET['Seleccion2'];
$grupo_seleccion1 = $con -> query("select Grupo from Seleccion where Nombre='$seleccion1'");
$grupo_seleccion2 = $con -> query("select Grupo from Seleccion where Nombre='$seleccion2'");
if($fila1 = $grupo_seleccion1 -> fetch_assoc()){
$var1 = $fila1['Nombre'];
}
if($fila2 = $grupo_seleccion2 -> fetch_assoc()){
$var2 = $fila2['Nombre'];
}
var_dump($var1);
if ( $var1 == $var2) {
echo "Son del mismo grupo";
}
else{
echo "No son del mismo grupo";
}
?>