I would like to print out rows from a mysql db as html. This is what I want to achieve:
<html>
<head>
...
</head>
<body>
<a href = "url1">name1</a>
<a href = "url2">name2</a>
...
</body>
</html>
My go code:
for rows.Next() {
var name string
var url string
err = rows.Scan(&name, &url)
if err != nil {
log.Fatal(err)
}
}
I thought that I could put the items into a slice and write them out with a for loop in a template, but instead of this is it possible to write out each line with the for loop in the go code?