How do I correctly pass the data type by PDO

4

In the php snippet below, what kind of PDO :: PARAM should I use?

$cnx = new PostgreSQL(); //Classe de conexão do banco
$data = '2015-02-13';
$select = 'SELECT * FROM eventos WHERE "data" = :data';
$query -> prepare($select);
$query -> bindParam(":data" , $data , ?)/
$result = $query -> execute();
$result = $query -> fetch(PDO::FETCH_ASSOC);
print_r($result);
    
asked by anonymous 13.02.2015 / 18:33

1 answer

1

The answer to the question is even PDO :: PARAM_STR, which as I said in the link below is for string, dates and times

.

  

- PDO :: PARAM_STR - for string values, dates, times ...

     

- PDO :: PARAM_INT - for integer values

     

- PDO :: PARAM_BOOL - for Boolean value (true or false)

     

- PDO :: PARAM_NULL - null value (null)

     

- PDO :: PARAM_LOB - represents large amounts of data

     

- PDO :: PARAM_STMT - Represents a recordset, currently not supported by any driver

     

- PDO :: PARAM_INPUT_OUTPUT - specifies that it is an input parameter for "stored procedures"

Source: link

    
13.02.2015 / 18:46