|
Welcome to Programmer's Room
|
前の方法はSQLite2に対応しているものです。SQLite3はこちらの方法でないと
動きません。
<html>
<body>
<h3>SQLite3のテスト</h3>
<table>
<?php
try{
$dbh = new PDO("sqlite:d:/database/sqlite.db");
$sth = $dbh->prepare("select * from test_tbl");
$sth->execute();
$i = 0;
while ($row = $sth->fetch()) {
$i++;
echo "<tr><td align=right>" . $i . "</td><td> " .$row['ipaddress']
. "</td><td nowrap>" . $row[1]
. "</td><td title='". $row[3] . "'>" . $row[2]
. "</td><td nowrap>" . $row[4] . "</td><td nowrap>" . $row[5]
. "</td></tr>";
}
} catch (PDOException $e) {
print "エラー!: " . $e->getMessage() . "<br/>";
die();
}
?>
</table>
</div>
</body>
</html>
【 戻 る 】