例えば「三重」と入れてみてください。学校名を部分一致で検索します(最大20件)。
<form action="schools1.php" method="post"> <p>学校名:<input name="name"></p> </form> <?php if (isset($_POST['name']) && $_POST['name'] != '') { try { $db = new PDO('sqlite:schools.db'); $s = $db->prepare("select * from schools where name like ? limit 20"); $s->bindValue(1, "%" . $_POST['name'] . "%"); $s->execute(); $result = $s->fetchAll(); echo "<table border='1'>\n"; echo "<tr><th>学校番号</th><th>学校名</th><th>住所</th><th>郵便番号</th></tr>\n"; foreach ($result as $r) { echo "<tr><td>", $r['id'], "</td><td>", $r['name'], "</td><td>", $r['address'], "</td><td>", $r['zip'], "</td></tr>\n"; } echo "</table>\n"; } catch (PDOException $e) { echo '<p>エラー: ', $e->getMessage(), '</p>'; } } ?>