I can’t get user id value

Asked

Viewed 75 times

1

I need to take the value of the user id and select in the database the records of that id.

Link

<a href="https://xxx/agendar.php?usuario=07b83439f6b5b7bc2f97905c8f2b208bf08a68fb&amp;senha=adcd7048512e64b48da55b027577886ee5a36350&amp;idbgta=2510" target="_blank" tabindex="-1" rel="external">Clique aqui para ver suas consultas</a>

Here I get the value of the user id:

$criptoNomeUsuario = $_GET["usuario"];
$criptoSenha = $_GET["senha"];


$confirmacao = "SELECT * FROM usuario WHERE userlogin = '$criptoNomeUsuario' and passlogin = '$criptoSenha' and ativo = 'sim' and nivel = 'paciente'";


$result_confirmacao = mysqli_query($conn, $confirmacao);

if (mysqli_num_rows($result_confirmacao) > 0) {
    while ($row = mysqli_fetch_assoc($result_confirmacao)) {


        $atendente_paciente = $row["atendente"];
        $id_usuarioeee = $row["id_usuario"];

        $nome_pacientew = $row["nome"];

        echo    "Atendente: ".$atendente_paciente;      

    }
} else {

}

Upshot

Atendente: 2

Now that comes the problem:

header('Content-Type: application/json');
$start = mysqli_real_escape_string($connection, $_GET["start"]);
$end = mysqli_real_escape_string($connection, $_GET["end"]);

$result = mysqli_query($connection, "SELECT `id`, `start` ,`end` ,`title`,`ativo`,`atendente` FROM  `events` where (date(start) >= '$start' AND date(start) <= '$end' AND ativo='sim' and atendente='".$atendente_paciente.
    "'   ) ");
while ($row = mysqli_fetch_assoc($result)) {

    $events[] = $row;

}


echo json_encode($events);

It doesn’t take the value of $patient, because this happens and how I could solve?

If I put the value of $patient manually works

$result = mysqli_query($connection,"SELECT `id`, `start` ,`end` ,`title`,`ativo`,`atendente` FROM  `events` where (date(start) >= '$start' AND date(start) <= '$end' AND ativo='sim' and atendente='2'   ) ");
        while($row = mysqli_fetch_assoc($result))
  • these two code are in the same file?

  • yes are in the same file

  • checks with a var_dump($atendente_paciente) if the variable is bringing the id

  • yes is bringing string(1) "2"

1 answer

0

Tried to pass the parameter the same way as the other $start and $end parameters ?

Thus:

$result = mysqli_query($connection, "SELECT `id`, `start` ,`end` ,`title`,`ativo`,`atendente` FROM  `events` where (date(start) >= '$start' AND date(start) <= '$end' AND ativo='sim' and atendente='$atendente_paciente') ");
  • so it didn’t work either

  • Are you making this query in the same test location that returns the correct result? "Attendant: ". $patient attendant_patient;

  • Yes they are in the same test location and return with the var_dump($attendant_patient) string(1) "2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.