2/4/2004 ↓

MySql Case Insensitive Order_by

If you like this post, please subscribe to our RSS feed to read our new posts every day.

While answering a question in the wordpress forums, I remembered an (obscure to me) function in php which generates a regular expressions ( regex ) to be used in a MySql query. This is very useful when performing a dynamic ORDER_BY or a SELECT and you do not want to use the LIKE statement. The syntax is as follows:
$new_string = mysql_regcase($string);
Where the $string was the original query string and the $new_string is the regex for that query string. I am not sure whether WordPress uses this or not. However, it sure could prove useful in unlikely circumstances.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

Visitors who read this post, also read:

    Friends

    Translate

    Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

    Latest Videos

    2 Comments | Leave a comment | Comments RSS

    1. test

      [Reply]

      Mark (14 comments.) — 02/7/2004 @ 8:21 pm
    2. Cool. I never knew this function existed.

      [Reply]

      Jason (1 comments.) — 08/6/2005 @ 11:20 pm

    Leave a comment

    Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    (required)

    (required, will not be published)


    S2