Here is the query I’ve been using to properly grab the correct title without “the” and all that nonsense.
$getfilms = mysql_query("select films.film_id,films.film_title,films.studio,films.director,films.writer,films.cast,films.release,films.film_keyw,films.image,films.mobile
, case when substring_index(film_title,' ',1)
in ('a','an','the')
then concat(
substring(film_title,instr(film_title,' ')+1)
,', '
,substring_index(film_title,' ',1)
)
else film_title
end as title2
from films
where case when substring_index(film_title,' ',1)
in ('a','an','the')
then concat(
substring(film_title,instr(film_title,' ')+1)
,', '
,substring_index(film_title,' ',1)
)
else film_title
end like '$letter%' AND films.mobile='y'
order
by title2",$cn);
This query has done me great. But now I need it to grab the first five rows (films) that begin with each letter in the alphabet as a preview display of our database by the letter. My brain is rattled on how to do this efficiently.
All feedback appreciated.
Thanks!
Ryan