Jump to content
Fórum Script Brasil
  • 0

(Resolvido)PDO - Erro em um Select


marcelo santan

Question

Senhores (as), estou iniciando estudos em PDO e essa parte de um codigo meu vem apresentando o seguinte erro:

Array ( [0]=> 42000 [1] => 1064 [2] => 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 ''5'' at line 1 ) 1

e segue o codigo abaixo, desse erro:

$busca = "SELECT * FROM imoveis WHERE destaque = :destaque and status = :status ORDER BY id_imovel DESC";
    $sql =  $conn->prepare("$busca LIMIT :inicio, :mostrarsuperdestaques");
    $sql->bindValue(':destaque', 2, PDO::PARAM_INT);
    $sql->bindValue(':status', 'Publicado', PDO::PARAM_STR);
    $sql->bindValue(':inicio', $inicio, PDO::PARAM_INT);
    $sql->bindValue(':mostrarsuperdestaques', $mostrarsuperdestaques, PDO::PARAM_INT);
    $sql->execute() or die(print_r($sql->errorInfo()));

se alguém tiver uma ideia do que possa estar ocorrendo, por favor, me dê esse help;

att

Edited by marcelo santan
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...