Does anyone know of a good method for sorting things by letter. I have a script with many reviews of different shows in it. I would like to be able to sort them a-g, h-j, k-m (you get the picture)
i came up with this method
$query = reg_query("SELECT * FROM reviews ORDER BY name ASC");
// Output The List
while ($data = fetcho_query($query)) {
if (substr($data['name'],0,1) == strtoupper($split)) break;
// Make overall rating
$rating = round(($data['rating_animation'] + $data['rating_characters'] + $data['rating_music'] + $data['rating_plot'] + $data['rating_sound'] + $data['rating_voiceacting']) / 6, 1);
$date = date("n/j/Y", $data['revid']);
$search = array('<LISTBIT: Name>', '<LISTBIT: Genre>', '<LISTBIT: Type>', '<LISTBIT: Date>', '<LISTBIT: Rating>', '<LISTBIT: ID>');
$replace = array($data['name'], $data['genre'], $data['type'], $date, $rating, $data['revid']);
$list_reviews .= str_replace($search, $replace, stripslashes($keybase['review_listbit']));
}
$split is the letter to stop displaying data at and this works, but i have not the slightest how to do something that would let me say start at "C" and stop at "S". If there is no way to do this through variables, I would settle for hard coding the sorting methods in to just being a-g, h-k strictly. If there is a way to do this through a query please share.
Matt