echo $_GET["code"];
コードの情報をDBから取得する
$time_start = microtime(true); $code = empty($_GET["code"])? 'null' : $_GET["code"]; echo $code. "<br>"; $dsn = "mysql:dbname=equity;host=localhost"; $user = "hoge"; $password = "hogehoge"; try { $dbh = new PDO($dsn, $user, $password); } catch (PDOException $e){ print('connection failed:'.$e->getMessage()); } $sql = "select * from lists where code = $code"; $stmt = $dbh->query($sql); $result = $stmt->fetch(PDO::FETCH_ASSOC); echo $result['name']. "<br>"; echo $result['sector']. "<br>"; echo $result['market']. "<br>"; echo "<br>"; $time = microtime(true) - $time_start; echo "{$time}秒";
OK!
パラメータからデータを読み込む
パラメータを変える
なるほど