SQL LIMIT 不适用于 define

SQL LIMIT doesn't work with define

我正在 PHP 中写一个 SQL 请求。该请求像这样工作得很好:

$testQuery = "SELECT `title` FROM `bibliography` Where title LIKE '%$search%'";

我需要添加一个限制。如果我添加一个带有数字的 LIMIT 它工作正常:

$testQuery = "SELECT `title` FROM `bibliography` Where title LIKE '%$search%' LIMIT 5";

但如果我使用定义:

define( 'PAGING', 2 );
$testQuery = "SELECT `title` FROM `bibliography` Where title LIKE '%$search%' LIMIT PAGING";

它抛出一个错误:

Undeclared variable: PAGING SQL=SELECT title FROM bibliography Where title LIKE '%%' LIMIT PAGING

然而,在代码的其他部分,PAGING 工作正常。为什么这不起作用,我如何使用定义来限制?

你能像这样在查询中传递一个变量而不是常量吗? (或者必须是常量)

$define = 5;
$testQuery = "SELECT `title` FROM `bibliography` Where title LIKE '%$search%' LIMIT $define";