0

I used mysql and now i want to update my code to PDO. I have a problem with query:

$stmt4 = $pdo->prepare("SELECT * FROM ore_lavoro WHERE dottore = :dottore AND disponibile = 'si' AND data = :data AND fine >= :fine AND inizio >= '1' AND inizio <= ".$start."");
$stmt4->execute(['dottore' => $dottore_disponibile,'data' => $data_final,'fine' => $end]); 
$count2 = $stmt4->rowCount();
print "There are " .  $count2 . " matching records.";
$data4 = $stmt4->fetchAll();

If i i make this query i have this message: "There are 0 matching records."

$stmt4 = $pdo->prepare("SELECT * FROM ore_lavoro WHERE dottore = :dottore AND disponibile = 'si' AND data = :data AND fine >= ".$end." AND inizio >= '1' AND inizio <= ".$start."");
$stmt4->execute(['dottore' => $dottore_disponibile,'data' => $data_final]); 
$count2 = $stmt4->rowCount();

If i make this, instead, i recived: "There are 1 matching records" that is the correct answer because in my db i have 1 row with this parameters. Why? What am I doing wrong This is my db: https://ibb.co/n6qNXMB

0 Answers0