I have this SQL / PHP statement
echo '¡Hola ' . htmlspecialchars($_POST["div"]) . '!';
$sql = "SELECT id_div FROM divisiones WHERE division_name = '$_POST[div]'";
$res = mysqli_query($conexion, $sql);
And what I want is to pass the id_div
that brings the sentence to a php variable to be able to insert it into an insert that I will do with SQL.
But it does not work and I think it's because I have this part wrong that I put.
How could I do it?
EDIT:
I add the code I use to insert it into an INSERT statement, I do not know if it's okay.
mysqli_query($conexion, "insert into result_equipo (id_reseq, id_div, jor, id_eq, puntos, pg, pp, n_p, fecha) VALUES
(NULL, '$res', '$_POST[jor]', '$_POST[equipos]', '2', '1', '0', '0', '$_POST[date]')");
Thanks