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&senha=adcd7048512e64b48da55b027577886ee5a36350&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?
– Tales Peres
yes are in the same file
– Wagner
checks with a
var_dump($atendente_paciente)
if the variable is bringing the id– Tales Peres
yes is bringing string(1) "2"
– Wagner