why i cannot mix prepared statements and PDO query()? [duplicate]

Why the following code prints nothing?:

<?php
error_reporting(E_ALL);
$db = new PDO("sqlite::memory:");
$db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec("CREATE TABLE IF NOT EXISTS book (
  id INTEGER PRIMARY KEY,
  name text,
  amount integer,
  day text
);
");

$stmt = $db->prepare('insert into book(name,amount,day) 
        values(:name,:amount,:day)');
        $stmt->bindValue(':name', 'foo', SQLITE3_TEXT);
        $stmt->bindValue(':amount', 102, SQLITE3_INTEGER);
        $stmt->bindValue(':day', '2022-12-28', SQLITE3_TEXT);
        $stmt->execute();

$result = $db->query("select * from book where `name`='foo'");
foreach($result as $r){
                        print $r['name']."n";
}

When i insert the row with PDO query(), then it would work, why?