I have go web server it make SQL request and show the result on WEB page.
This is Go code:
func PageHandler(w http.ResponseWriter, r *http.Request) {
rows, _ := database.Query("select .......;")
defer rows.Close()
user_current := []User{}
for rows.Next() {
p := User{}
err := rows.Scan(&p.Name1, &p.Name2 )
if err != nil {
fmt.Println(err)
continue
}
user_current = append(user_current, p)
}
tmpl, _ := template.ParseFiles("page.html")
tmpl.Execute(w, user_current)
}
And this is my HTML web page:
<table>
<thead><th>name1</th><th>name2</th></thead>
<tr>
<td></td>
<td></td>
</tr>
</table>
I want 2 or multiple tables in web page (data different in tables), But I don't how to do this
somthing like this:
<table1>
<thead><th>name1</th><th>name2</th></thead>
<tr>
<td></td>
<td></td>
</tr>
</table1>
<table2>
<thead><th>sign1</th><th>sign2</th></thead>
<tr>
<td></td>
<td></td>
</tr>
</table2>
Aucun commentaire:
Enregistrer un commentaire