I'm fetching some rows from my database into a HTML table like this:
$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";
}
The problem is that I'd like to print the link
(which I selected above) as a actual link. (so like a href
...) But I've no idea how to do this and looked everywhere for a solution.