IDのチェック
if (preg_match('/^[1-9][0-9]*&/', $_GET['id'])) { $id =(int)$_GET['id']; } else { echo "不正なIDです!"; exit; }
表示するデータの取得
- idをもとにデータを取得
&stmt = $dbh->prepare("select * from intries where id = :id limit 1"); $stmt->execute(array(":id" => $id)); $entry = $stmt->fetch() or die("no one found!"); $name = $entry['name']; $email = $entry['email']; $memo = $entry['memo'];