Pagination in badgesGET
This commit is contained in:
parent
12aaa04fea
commit
e6c77e64a8
|
@ -25,10 +25,9 @@ func BadgesGET(md common.MethodData) common.CodeMessager {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if md.Query("id") != "" {
|
if md.Query("id") != "" {
|
||||||
// TODO(howl): ID validation
|
rows, err = md.DB.Query("SELECT id, name, icon FROM badges WHERE id = ? LIMIT 1", md.Query("id"))
|
||||||
rows, err = md.DB.Query("SELECT id, name, icon FROM badges WHERE id = ?", md.Query("id"))
|
|
||||||
} else {
|
} else {
|
||||||
rows, err = md.DB.Query("SELECT id, name, icon FROM badges")
|
rows, err = md.DB.Query("SELECT id, name, icon FROM badges " + common.Paginate(md.Query("p"), md.Query("l"), 50))
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
md.Err(err)
|
md.Err(err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user