"SQL syntax error" DO NOTHING after 1 year running

0

For 1 year my company's software worked if it got into trouble, until on a beautiful day out of nowhere this happens (it's giving us a lot of headache and cost):

    PHP Fatal error:  Uncaught exception 'PDOException' with message
'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in 
your SQL syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near 'get FROM Acompanhamento WHERE alunoid = '2767' 
and excluido = 0 ORDER BY data de' at line 1' in /.../dao/DboObject.php:27

Stack trace:

#0 /.../DboObject.php(27): PDOStatement->execute(Array)
#1 /.../AcompanhamentoAlunoDao.php(24): DboObject->select('SELECT id, peso...', Array)
#2 /.../AcompanhamentoAlunoBo.php(19): AcompanhamentoAlunoDao->select('alunoid = ? and...', Array)
#3 /.../ficha_de_acompanhamento.php(38): AcompanhamentoAlunoBo->getAcompanhamentoByAluno('2767')
#4 {main}
  thrown in /.../DboObject.php on line 27

Code in the files mentioned by Stack Trace (I put ** at the beginning and end of the specific lines mentioned by the stack trace).

DboObject.php:

public function select($sql='',$args){
        $this->query = $this->pdo->prepare($sql);
        **$this->query->execute($args);**
        $this->result = $this->query->fetchAll(PDO::FETCH_OBJ);
    }

MonitoringAlunoDao.php:

parent::select($sql, $args);

TrackingAlunoBo.php:

public function getAcompanhamentoByAluno($alunoId,$campo=null){
        **$query = "alunoid = ? and excluido = 0 ";**
        if(!is_null($campo)){
            $query.= "and ".$campo." is not null ";
        }

tab_to_application.php:

$acompanhamento = $acompanhamentoAlunoBo->getAcompanhamentoByAluno($AlunoId);

What is very strange is that it has worked for so long and without a line of code being altered to present this problem.

    
asked by anonymous 29.09.2018 / 00:14

0 answers