PDO displaying the populated query

Asked

Viewed 31 times

0

Well, here’s the thing function:

public function inserir (ClientesModelos $_cliente) : bool {

        $sql = 'INSERT INTO clientes 
(data, nome, sobreNome, nascimento, documento, telefone, celular, email, senha, bloqueio) 
VALUES (?,?,?,?,?,?,?,?,?,?)';

        $inserir = $this->pdo->prepare ($sql);

        $inserir->bindValue (1, $_cliente->getData()->format("Y-m-d 00:00:00"));
        $inserir->bindValue (2, $_cliente->getNome());
        $inserir->bindValue (3, $_cliente->getSobreNome());
        $inserir->bindValue (4, $_cliente->getNascimento()->format("Y-m-d 00:00:00"));
        $inserir->bindValue (5, $_cliente->getDocumento());
        $inserir->bindValue (6, $_cliente->getTelefone());
        $inserir->bindValue (7, $_cliente->getCelular());
        $inserir->bindValue (8, $_cliente->getEmail());
        $inserir->bindValue (9, $_cliente->getSenha());
        $inserir->bindValue (10, $_cliente->getBloqueio());

        return $inserir->execute();

    }       

A string sql is with (?,?,?,?,?,?,?,?,?,?)

I would like to know how I print the exit of query string already with ? (interrogations) filled.

Type:

  INSERT INTO clientes (
  data, 
  nome, 
  sobreNome, 
  nascimento, 
  documento, 
  telefone, 
  celular, 
  email, 
  senha, 
  bloqueio
) VALUES (
  '2010-05-05',
  'José',
  'Miguel',
  '2000-10-10',
  '1111111111',
  '11111111111',
  '1111111111',
  '[email protected]',
  'senha',
  'não'
)
No answers

Browser other questions tagged

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