FAQ
Please don't Sprintf SQL commands. Ever, for any reason.

Go's SQL package uses "?" for params -- just read the documentation of
database/sql.

Niko


On Tuesday, February 10, 2015 at 10:04:04 PM UTC+1, John Potocny wrote:

I believe your code should read like this:

sql = fmt.Sprintf("SELECT * FROM `articles` ORDER BY `id` DESC LIMIT %d,
10", Load)

Assuming Load is an integer type var, you need to format using %d as I did
above.

On Tuesday, February 10, 2015 at 3:13:10 PM UTC-5, myal...@gmail.com
wrote:
i used Sprintf but i have problem

sql = fmt.Sprintf("SELECT * FROM `articles` ORDER BY `id` DESC LIMIT
%s,10",Load)

this is error message :


<https://lh6.googleusercontent.com/-RCaUtt9_1vM/VNpmPX-e5XI/AAAAAAAAAAM/_vYwEetJjLI/s1600/eerr.PNG>
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 8 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 10, '15 at 5:35p
activeFeb 16, '15 at 5:16a
posts8
users6
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase