You are here: REGEX: can't seem to replace LIMIT clause in query using preg_replace ($pattern, $replacement, $query) « PHP Programming Language « IT news, forums, messages
REGEX: can't seem to replace LIMIT clause in query using preg_replace ($pattern, $replacement, $query)

Posted by lawrence k on 04/13/06 05:51

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация