Skip to content

Instantly share code, notes, and snippets.

@raismaulana
Last active September 23, 2022 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raismaulana/92e12b16996a2988fa3d77a8fd8daff1 to your computer and use it in GitHub Desktop.
Save raismaulana/92e12b16996a2988fa3d77a8fd8daff1 to your computer and use it in GitHub Desktop.
unsafe_single_query.go
func query(db *sql.DB, name string) {
query := fmt.Sprint("select id, name, grade from students where name = '%s'", name)
_, err := db.Query(query)
if err != nil {
fmt.Println(err.Error())
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment