I've only just started learning PHP so bare with me..
I want to display book titles alphabetically but some titles are in the format "The Blah Book" and I want to display them as "Blah Book, the" and order them by this new first letter (ie the above is "B", not "T").
To my understanding there are three options:
- a mysql select query
I don't know how to structure this but a friend said for some other database it might be in the format:
SELECT DECODE(SUBSTR(title, 0, 4), 'The ',SUBSTR(title, 5) || ', The', title)
FROM novel
ORDER BY title
can anyone re-interpret that for me to work with mysql?
- php substr and then sort
If I'm only listing the titles then it works perfectly.
But for the page, I first get the name of an author and then display the titles which correspond to them - at this point the page starts sprouting the title multiple times (my error obviously but i don't understand what I've done wrong).
- manual change
Change the titles through my admin page but I really would prefer not to resort to this.
any assistance with code snippets for 1 or 2 much appreciated.
niina