I am using sqlx for with mysql driver, but when I execute an insert statement I got "Error 1064: You have an error in your SQL syntax;"
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
)
func main(){
db, _ := sqlx.Connect("mysql", "connetionStr")
query := fmt.Sprintf("insert into bot(poster_id,name,welcome_msg,exit_msg) values(?,?,\"%s\",\"%s\")", "hello", "bye")
result := db.MustExec(query, 1, "bot_name")
}
The syntax is certainly not wrong there. The problem is with the db.MustExec function. Why is it not replacing the ? place holder