By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

preg_replace not working in server

P: 33

I am using this code to make my query nice
Expand|Select|Wrap|Line Numbers
  1. // Make nice query, remove multiple: spaces, '`' (safe slashes), 'AND', 'OR', ...
  2. $pattern = array ( '/(AND[\s])+/', '/(OR[\s])+/', '/\s+/', '/`+/', '`^[^\w\d]`', '`[^`\w\d]$`' );
  3. $replace = array ( 'AND '        , 'OR '        , ' '    , '`'   , ''        , ''         );
  4. $search_preferences['SQL_Query']     = preg_replace ($pattern, $replace, $search_preferences['SQL_Query']    );
This is working perfect in my local system.

PCRE (Perl Compatible Regular Expressions) Support is enabled in both server and local

Please help

Thanks and regards
Jun 18 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 5,821
Heya, Ruth.

Does the preg_replace() do anything on your server?

Post an example of a query, how it looks after you run the preg_replace() on your local machine and how it looks after you run the preg_replace() on the server.
Jun 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.