preg_replace not working in server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RuthC
    New Member
    • Nov 2007
    • 33

    preg_replace not working in server

    Hi,

    I am using this code to make my query nice
    Code:
    // Make nice query, remove multiple: spaces, '`' (safe slashes), 'AND', 'OR', ...
    $pattern = array ( '/(AND[\s])+/', '/(OR[\s])+/', '/\s+/', '/`+/', '`^[^\w\d]`', '`[^`\w\d]$`' );
    $replace = array ( 'AND '        , 'OR '        , ' '    , '`'   , ''        , ''         );
    $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
    RuthC
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    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.

    Comment

    Working...