Jump to content

(Solved) PDO Mysql error


gmc1103

Recommended Posts

Hello

I'm having prblem regarding this query, it gives me the following error
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 ':idCursos' at line 12

The query is the following

select c.idPlan, cD.disciplina, cM.moduloUfcd, p.Nome, t.Turma, a.Ano, c2.curso,
                                               c.validPlan, c.planificacao, c.dataLimite, c.idProfessor,
                                               c.pdf,c.inicio,c.fim,c.objetivos,c.conteudos,c.competencias,
                                               c.estrategias, c.recursos, c.avaliacao,c.criado
                                        from cpDiscProfessores c
                                                 inner join cpDisciplinas cD on c.idcpDisciplinas = cD.idCpDisciplinas
                                                 inner join cpModulos cM on c.idCpModulos = cM.idCpModulos
                                                 inner join professores p on c.idProfessor = p.idProfessor
                                                 left join turmas t on c.idTurma = t.idTurma
                                                 inner join anosescolares a on c.idAnoEscolar = a.idAnoEscolar
                                                 left join cursos c2 on c.idCursos = c2.idCursos where a.Estado = 1 AND c2.idCursos=:idCursos");
            $stmt->bindparam(":idCursos", $idCursos, PDO::PARAM_INT

Ok, this query accept one pamater, and i have checked it is not empty

array(4) { ["total"]=> string(1) "1" [0]=> string(1) "1" ["idCursos"]=> string(1) "1" [1]=> string(1) "1" }
IdCursos: 1
isDC: 1

 

SOLVED: copy/paste and didn't see i was using "query" instead of "prepare"

 

 

 

Edited by gmc1103
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.