1
I need to store the result count, but apparently with PDO I can’t store the value. I’ve already select on the outside and the result comes, because I can’t store in the variable $flag the result? 
    $query = "SELECT COUNT(*) as flag FROM RESERVAS
              WHERE DATA_RETORNO_REAL = '0000-00-00' AND
                    COD_VEICULO = :veiculo and
                    DATE_FORMAT(DATA_SAIDA, \'%d-%m-%Y\') = :data_reserva
                    ";
    $data = $conexao->prepare($query);    // Prepare query for execution
    $data->execute(array(
    ':veiculo' => $veiculo,
    ':data_reserva' => $data_reserva
    ));
    $saidas = $data->fetch();
    $flag = $saidas['flag'];
On the outside:

Do this -
var_dump($saidas);- and put the return here.– Edilson
solved taking out DATE_FORMAT(DATA_SAIDA, '%d-%m-%Y') = :data_reserve and replaces by data_output = kurdate(). I do not know why here do not work....
– Diego
Now that you say it, with the
\'you were slipping the quotes ('), for this reason did not work, experiment puttingDATE_FORMAT(DATA_SAIDA, '%d-%m-%Y').– Edilson