我将数据库中的某些行提取到HTML表中,如下所示:
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $dbh->prepare("SELECT sportnaam, beschrijving, link FROM sporten");
$stmt->execute();
$arrValues = $stmt->fetchAll(PDO::FETCH_ASSOC);
// open the table
print "<table >\n";
print "<tr>\n";
// add the table headers
foreach ($arrValues[0] as $key => $useless){
print "<th></th>";
}
print "</tr>";
// display data
foreach ($link as $rows){
print "<tr>";
}
foreach ($arrValues as $row){
print "<tr>";
foreach ($row as $key => $val){
print "<p>$val</p>";
}
print "</tr>\n";
}
// close the table
print "</table>\n";
}
问题是,我想将link
(我在上面选择的)打印为实际链接。 (所以就像a href
...)但我不知道如何做到这一点并且到处寻找解决方案。