Last active
September 23, 2022 06:23
-
-
Save raismaulana/92e12b16996a2988fa3d77a8fd8daff1 to your computer and use it in GitHub Desktop.
unsafe_single_query.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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