How to properly step data type by PDO

Asked

Viewed 315 times

4

In the php section below, what is the type 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);

1 answer

1


The answer to the question is even PDO::PARAM_STR, which as it was said in the link I leave the bottom serves to 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 (null)

- PDO::PARAM_LOB - represents large amount of data

- PDO::PARAM_STMT - represents a set of records, currently not supported by any driver

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

Source: http://fazer-site.net/pdo-php-data-object/

Browser other questions tagged

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