I'm using this to retrieve information from a database, the query always brings errors
我正在使用它从数据库中检索信息,查询总是会带来错误
This is my query:
这是我的查询:
SELECT * FROM users ORDER BY RAND() LIMIT '10'
It always brings up errors on either the ORDER BY RAND()
or the LIMIT '10'
.
它总是会在ORDER BY RAND()或LIMIT'10'上出现错误。
Any reason why this is happening? Also is there any solutions to this?
出现这种情况的原因是什么?还有什么解决方案吗?
3 个解决方案
#1
11
Limit should be integer? 10 instead '10'.
限制应该是整数?而不是'10'。
#2
2
SELECT *
FROM affiliate
ORDER BY RAND()
LIMIT 10
Note there are no quotes around 10
注意10左右没有引号
#3
1
The LIMIT parameter is a number, not a string:
LIMIT参数是一个数字,而不是字符串:
SELECT * FROM users ORDER BY RAND() LIMIT 10
Whitout the quotes.
打开报价。
#1
11
Limit should be integer? 10 instead '10'.
限制应该是整数?而不是'10'。
#2
2
SELECT *
FROM affiliate
ORDER BY RAND()
LIMIT 10
Note there are no quotes around 10
注意10左右没有引号
#3
1
The LIMIT parameter is a number, not a string:
LIMIT参数是一个数字,而不是字符串:
SELECT * FROM users ORDER BY RAND() LIMIT 10
Whitout the quotes.
打开报价。