I'm trying to pull data from my database for an index (where the user clicks on the letter and all titles starting with that letter are listed) and I want the SELECT command in the mysql statement to ignore the articles (The, An, A) for any titles that start with them.
I was successful doing this to SORT my data (it puts it in alphabetical order and ignores the THE, etc). But I'm having trouble getting the notation down so that it selects the data that way to. I didn't know if this would be better suited using PHP or if there is something in the MYSQL statement that would also achieve this.
Here is my statement so far that works when it comes to sorting, but not fetching...
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, date, imagethumb, category FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by TRIM(LEADING 'a ' FROM TRIM(LEADING 'an ' FROM TRIM(LEADING 'the ' FROM LOWER(`title`))))");
Should php be used for this in the $letter statement?
This precedes the query statement:
$letter = substr("$letter", 0,1);