"SQL syntax error" FROM NOTHING after 1 year running

Asked

Viewed 47 times

0

For 1 year the software of my company worked if problems, until on a beautiful day of nothing happens it (is 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 (put ** at the beginning and end of the specific lines mentioned by 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);
    }

Acompanhaentoalunodao.php:

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

Acompanhaentoalunobo.php:

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

ficha_de_accompaniment.php:

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

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

  • What is the value of $sql and $args passed to the select?

  • 1

    Nothing has changed ? Version ? In the table ? Software is not tomato , does not spoil. :)

No answers

Browser other questions tagged

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