You are here: Sorting Movie Titles from a Database of Reviews « PHP SQL « IT news, forums, messages
Sorting Movie Titles from a Database of Reviews

Posted by eklund on 06/14/06 22:27

Hello, I hope I can get some help on this. I really really really need
to get this working!

Here is an overview of what I am trying to do. I have a database of
movie reviews, and I am trying to sort them alphabetically. (So I can
select all reviews starting with $someletter) The catch is I don't want
titles starting with The to be included with T. For example. "The
Exorcism of Emily Rose" will be under E, not T. Preferably ignoring "A"
as well, as in "A Nightmare on Elm Street" but I don't want to get
greedy. :-)

Here is what I got so far.
$sreview = mysql_query ("SELECT * FROM reviews ORDER BY REPLACE(Title,
'The ', '') ASC");

That will arrange it alphabetically, and it ignores "The" when sorting,
but outputs it later on when I ask for the title. So far, so good.


Next, I want to sort them for every review starting with $id (A letter,
number, or group of letters, or a group of numbers.

I figured out this:
WHERE Title LIKE '$id%' //$id being a letter of the alphabet, or a
number

But I can't get that to work in my script. If I put it in front of the
ORDER BY REPLACE it does not include the entries that have "The" in
front of them. If I put it after the ORDER BY REPLACE it does not work
at all.



What I would like to have is a script that I can sort by a single
letter/number, or a group of them. (0-9, A-I, etc.) And ignoring The,
and hopefully A.

Can someone help me out, or at least point me in the right direction.

Thanks a lot!
~Rich

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация