|
Posted by lawrence k on 04/13/06 09:22
OK, my bad, the pattern needed to be case insenstive. This worked:
$pattern = "(.*)limit (.*)";
$replacement = '$1';
$replacement .= "LIMIT $limit,";
$replacement .= '$2';
$query = preg_replace ('/(.*)limit (.*)/i', $replacement, $query);
lawrence k wrote:
> Want to replace the limit clause in a query, but can't get it right.
> What's wrong with this:
>
> $pattern = "(.*)limit (.*)";
> $replacement = '$1';
> $replacement .= "LIMIT $limit";
> $replacement .= '$2';
> $query = preg_replace ($pattern, $replacement, $query);
>
>
> All I get back is:
>
> LIMIT 700
Navigation:
[Reply to this message]
|