learningtech
learningtech

Reputation: 33747

go mysql SELECT query causes variable assignment error

I'm new to Go and I'm trying to query a mysql database. I tried the following code:

rows, err := db.QueryRow("SELECT * FROM t_users")

But running the go run main.go gives this error:

cannot assign 1 values to 2 variables

But I don't get any errors for this:

rows, err := db.Query("DESCRIBE t_user")

How come my select statement is giving an error?

Upvotes: 0

Views: 438

Answers (1)

learningtech
learningtech

Reputation: 33747

mkopriva's response

QueryRow returns one value, Query returns two

Upvotes: 2

Related Questions