I need to store the result count, but apparently with the PDO I can not store the value. I have already circled the select
out and come the result, why can not I store the result $flag
in the variable?
$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: