I have to get the id of my user and save in a variable the name of this id, but it is not working!
function inReg() {
global $connect;
$id_usuario = $_POST["id_usuario"];
$denuncia = $_POST["denuncia"];
$nome = "SELECT nome FROM usuario WHERE id_usuario = '$id_usuario'";
$query = " Insert into denuncia (id_usuario, denuncia) values
('$id_usuario','$denuncia')";
mysqli_query($connect, $query) or die (mysqli_error($connect));
mysqli_close($connect);
require 'rotinas_emails/registro_denuncia_mail.php';
}
?>
In this variable $ name is saving the sql itself "New Report sent by SELECT name FROM user WHERE userid = '74'"