Steph,

> Hi. Im using MySQL and as part of my tables I have titles (of stories).
> My question os in regards to outputing those titles. Some of the titles
> begin with words such as 'The', 'A', 'An', etc. Is there a way to order
> these particular titles based on the second word in the title??

Late reply -- I don't check this folder that often.

I had this exact problem.  Don't bother with temp tables, or extra fields,
or anything like that.  You can build it all into your MySQL query.  A
resident MySQL expert gave me this recipe (well, one very similar):

<?
  $query = 'SELECT title_field, some_other_fields
            FROM some_table
            WHERE some_field = 'some_criteria'
            ORDER BY TRIM(leading "An " from
                     TRIM(leading "A " from
                     TRIM(leading "The " from title_field)))
           ';
?>

No fuss, no muss.  You don't have to worry about what order they were
inserted in, artificially munging your data, or anything else.

HTH!

-- 
[ joel boonstra | [EMAIL PROTECTED] ]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to