我正在使用常量NEWS_POST_NUMBER
,我对如何将其附加到字符串以将其查询到数据库感到困惑。我尝试了很多东西而且是错误的。
这是我试过的字符串。
$query = "
SELECT news.id, news.timestamp, news.title
FROM news
ORDER BY id DESC
LIMIT $from, NEWS_POST_NUMBER";
请注意NEWS_POST_NUMBER
是我定义的常量我想附加它以查询我该怎么做?
答案 0 :(得分:3)
$query = "SELECT news.id, news.timestamp, news.title FROM news ORDER BY id DESC LIMIT $from, " . NEWS_POST_NUMBER;
答案 1 :(得分:2)
$query = "
SELECT news.id, news.timestamp, news.title
FROM news
ORDER BY id DESC
LIMIT $from, " . NEWS_POST_NUMBER;