Fatal error: Call to Undefined Function query

Asked

Viewed 41 times

0

Can someone help me with this mistake:

Fatal error: Call to Undefined Function query()

My code:

<html>
    <head>
        
        <meta charset="UTF-8">
        <title> Perfil Candidato(a) !  </title>
        
        <!-- Referencia ao Bootstrap -->
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        <!-- Referencia ao FontAwesome -->    
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
        <link rel="stylesheet" href="css/fontes.css">
        
        
        
        
    </head>
    <body>
    <?php
    
       include "MenuzinCandi.php";
       include "conexao.php";
      
    
       
       $emailUsuario = $_GET['User'];
   
    $rsCandidato = consultarCandidato($vConn, $emailUsuario);
               
       
     
    while ($dadosCandi = mysqli_fetch_array($rsCandidato)){
    
    $_SESSION['Nome'] = $dadosCandi['Nome'];
    $_SESSION['Datadenascimento'] = $dadosCandi['Datadenascimento'];
    $_SESSION['CPF'] = $dadosCandi['CPF'];
    $_SESSION['endereço'] = $dadosCandi['endereço'];
    $_SESSION['cidade'] = $dadosCandi['cidade'];
    $_SESSION['estado'] = $dadosCandi['estado'];
    $_SESSION['email'] = $dadosCandi['email'];
    $_SESSION['telefone'] = $dadosCandi['telefone'];
    $_SESSION['celular'] = $dadosCandi['celular'];
    $_SESSION['escolaridade'] = $dadosCandi['escolaridade'];
    $_SESSION['pretensãosalarial'] = $dadosCandi['pretensãosalarial'];
    $_SESSION['habilidades'] = $dadosCandi['habilidades'];
    $_SESSION['sobrecandidato'] = $dadosCandi['sobrecandidato'];
    $_SESSION['permissao_cand'] = $dadosCandi['permissao_cand'];
    $_SESSION['Username'] = $dadosCandi['Username'];
    $_SESSION['senha'] = $dadosCandi['senha'];
    $_SESSION['permissao'] = $dadosCandi['permissao'];
    
    
        
    ?>

        
        
        
        <br>
        <br>
        <div class="container">
        
        <div class="row justify-content-md-center">
            
        <font class="FonteTitle"> Perfil do Candidato(a) ! </font>
        
        </div>
        <br>
        <br>
        <br>
        
        <div class="row">
            <div class="col-lg-1">
            
            </div>
            <div class="col-lg-6">
            Nome: <?php $dadosCandi['nome']?>
            </div>
            <div class="col-lg-5">
            Data de Nascimento:  <?php $dadosCandi['Datadenascimento']?>
            </div>
           
        </div>   
            <br>
            <br>
            <div class="row">
             <div class="col-lg-1">
            
            </div>
            <div class="col-lg-5">
            Endereço: 
            </div>
            <div class="col-lg-3">
             Cidade:  
            </div>
            <div class="col-lg-3">
            Estado: 
            </div>
            
            </div>  
        
            <br>
            <br>
            
            <div class="row">
            <div class="col-lg-1">
            
            </div>
            <div class="col-lg-4">
            E-mail: 
            </div>
            <div class="col-lg-3">
            Telefone:  
            </div>
            <div class="col-lg-3">
            Celular: 
            </div> 
                  
            </div>
            
            <br>
            <hr>
            <hr>
            <br>
            
            <div class="row">
    <div class="col-lg-1"></div>
    
              <div class="col-lg-3">
       Escolaridade: 
   
            </div>      
                
             <div class="col-lg-4">
            
            </div> 
             
             <div class="col-lg-3">
        Pretensão Salarial:  
        </div> 

    </div>
    <br>
    <div class="row">
        <div class="col-lg-1"></div>
        
        <div class="col-lg-4">
           Curso: 
          
        </div>
        
        <div class="col-lg-3">
            
            </div> 
        
        <div class="col-lg-3">
         Cargo:  
         
        </div> 
         </div>
        <br>
        <div class="row">
        
        <div class="col-lg-1"></div>
        
        <div class="col-lg-3">
      Previsão de término:  
       
        </div>
        
        <div class="col-lg-4">
       
        </div>
        
        <div class="col-lg-3">
       Habilidades: 
       
        </div>
        
        
    </div>
        <br>
        <div class="row">
            <div class="col-lg-1"></div>
            
            <div class="col-lg-10">
                
                <label> Sobre o Candidato: </label>
           
                
            </div>
            
            
            
        </div>
            
    <?php } ?>  
        
        </div>
        
    </body>
    <html

My duties:

<?php 
   include "Conexao.php";


function consultarCandidato($vConn, $emailUsuario){
    
    $sqlCandidato = "Select * from candidato A, login O where '$emailUsuario' = A.email and O.email = A.email";
    $rsCandidato = mysqli_query($vConn, $sqlCandidato) or die(mysqli_error($vConn));
    
    return $rsCandidato;    
}
?>

1 answer

1


all right? buddy very likely the php file that has "my functions" is not being included in the page. To confirm use in your main code

include "MenuzinCandi.php";
include "conexao.php";
if (function_exists('consultarCandidato')) { 
   $emailUsuario = $_GET['User'];
   $rsCandidato = consultarCandidato($vConn, $emailUsuario);
}else{
   exit("php não encontrou a função")
}

Then just include it, if it still doesn’t work try to put the function in the main file itself, just to make sure that the problem is really include.

Yet you are on the right track, but there is a more subtle problem! You use "include "Conexao.php";" in the main file and in the file with the function. I recommend that you use only in one or only in the other. preferably in separate files to call methods.

I hope it helps, any doubt I’m available.

  • Thank you very much, it worked here, I had to include the direct function in the main. And thanks for the tip of include, I’m beginner in php and help me mt

Browser other questions tagged

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