0

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?

2
  • 5
    QueryRow returns one value, Query returns two. Commented Nov 19, 2017 at 14:57
  • Great that makes sense now, and it worked. Commented Nov 19, 2017 at 15:03

1 Answer 1

2

mkopriva's response

QueryRow returns one value, Query returns two

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.