-1

I'm trying to insert with PDO id_facebook (mysql bigint), name(mysql varchar) and email(mysql varchar), but can not resolve this error, the PDO syntax looks correct, what can be?

public static function inserirUsuarioFacebook($id_facebook, $nome, $email)
{
    try
    {
        $pdo = Conexao::getInstance();

        $consulta = $pdo->prepare("INSERTO INTO usuario_facebook (id_facebook, nome, email) VALUES (:id_facebook, ':nome', ':email')");
        $consulta->bindParam(':id_facebook', $id_facebook, PDO::PARAM_INT);
        $consulta->bindParam(':nome', $nome, PDO::PARAM_STR);
        $consulta->bindParam(':email', $email, PDO::PARAM_STR);
        $consulta->execute();   
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
    }
}
sqlab
  • 6,412
  • 1
  • 14
  • 29
Gustavo Piucco
  • 377
  • 1
  • 3
  • 9

1 Answers1

5

You don't quote placeholders. That turns them into strings, not placeholders:

... VALUES(:id_facebook, :nome, :email)
                         ^----^-^-----^--- note the lack of quotes

is all that's required

The whole point of placeholders is to remove any need for quoting/escaping. The DB engine takes care of all that for you.

Marc B
  • 356,200
  • 43
  • 426
  • 500