I am using the following query to query the DB. But I get the error sql: expected 0 arguments, got 1
.
Following is the code that I am using:
row := DB.QueryRow(`SELECT COUNT(*) FROM Users WHERE Id = "%s";`, userID)
if err != nil {
return err.Error()
}
I am using the following package and driver
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
Edit:
I also tried with the following query, but I get the same error.
row := DB.QueryRow(`SELECT COUNT(*) FROM Users WHERE Id = "$1";`, userID)
if err != nil {
return err.Error()
}