开发者

Show Random quote from database?

开发者 https://www.devze.com 2023-02-13 12:13 出处:网络
I have a database that holds quotes, i.e开发者_开发问答 Mysql \" id,user_who_posted,quote,year,author \" I would like to make it show a random quote by id.Is this possible?SELECT id,user_who_posted,qu

I have a database that holds quotes, i.e开发者_开发问答 Mysql " id,user_who_posted,quote,year,author " I would like to make it show a random quote by id.Is this possible?


SELECT id,user_who_posted,quote,year,author FROM table ORDER BY RAND() LIMIT 1


SELECT id,user_who_posted,quote,year,author 
FROM table
ORDER BY RAND()
LIMIT 1

more randoms at http://www.petefreitag.com/item/466.cfm

0

精彩评论

暂无评论...
验证码 换一张
取 消