📄 8-1.php
字号:
<html><head><title>Bond Movies</title></head>
<body>
<table border=1>
<tr><th>Movie</th><th>Year</th><th>Actor</th></tr>
<?php
// connect
require_once('DB.php');
$db = DB::connect("mysql://user:seekrit@localhost/bondb");
if (DB::iserror($db)) {
die($db->getMessage());
}
// issue the query
$sql = "SELECT movies.title,movies.year,actors.name
FROM movies,actors
WHERE movies.actor=actors.id
ORDER BY movies.year ASC";
$q = $db->query($sql);
if (DB::iserror($q)) {
die($q->getMessage());
}
// generate the table
while ($q->fetchInto($row)) {
?>
<tr><td><?= $row[0] ?></td>
<td><?= $row[1] ?></td>
<td><?= $row[2] ?></td>
</tr>
<?php
}
?>
</table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -