作者macaca625 (MACACA)
看板PHP
標題[請益] LIMIT用法錯誤嗎
時間Tue Nov 22 11:13:20 2011
小弟是php新手
最近在研究網站,遇到一個瓶頸
想要從goods這個資料表裡面取出物品資料,
並且按照更新日期降冪排列取出20個最近變動過的
另外good_visible這個屬性值為一代表這不是隱藏商品這樣
但是....
SELECT *
FROM goods
WHERE goods_visible = 1
ORDER BY goods_date DESC limit 20
請問各位大大這樣打有錯誤嗎
因為我網頁run下去之後出現
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'LIMIT 0, 18' at
line 1
苦惱到炸掉阿!!!!!!!!
--
feel the muzik,
change the world .
http://www.wretch.cc/blog/kevinishere
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.193.69.240
1F:→ mervynW:LIMIT 0 OFFSET 18 11/22 11:19
2F:→ chrisQQ:你的 sql 給 limit 20,錯誤噴 limit 0, 18 ? 11/22 11:21
3F:→ knives:推樓上,我也覺得怪怪的,limit 後面只給一個數字是沒問題 11/22 11:24
4F:→ knives:你確定是這句錯? 11/22 11:24
5F:→ MOONRAKER:你是不是有用什麼自動分頁的套件 11/22 11:55
6F:→ tyf99:把實際上送給 mysql 的指令印出來對照一下 11/22 19:53
7F:→ s0300453:limit 0,20 11/23 01:32