function stars($star_rating){ $array = explode('.',$star_rating); $stars = ''; if(preg_match('@[0-4]@',$array[0])){ for($i=0;$i<$array[0];$i++){ $stars .= '*'; } } if(count($array)==2){ $stars .= '1/2'; } if(preg_match('@[A-Z]@',$star_rating)){ $stars .= $star_rating; } if($star_rating=='0'){ $stars .= '(no stars)'; } $stars = ''.$stars.''; return $stars; } function _e($str){ return htmlspecialchars($str); } require_once('mysql.php'); $db = new MySQL; $db->connect(); $result = $db->select("SELECT * FROM master_list ORDER BY star_rating DESC,title ASC"); ?> All the movies I've ever seen (that I remember so far, anyway), organized by extremely wishy-washy star ratings. (Four-star movies are pretty much my all-time faves, though.)
while($movie = $db->get_row($result)): ?> if($movie['star_rating']!='DNF' && $movie['star_rating']!='N/A' && $movie['star_rating']!='W/O'): ?> if($movie['star_rating']!=$last_star_rating): ?>
= stars($movie['star_rating']) ?>
endif; $last_star_rating = $movie['star_rating']; ?>
= _e($movie['title']) ?> (= _e($movie['year']) ?>, = _e($movie['directors']) ?>)
endif; endwhile; ?>
$result = $db->select("SELECT * FROM master_list WHERE star_rating='N/A' OR star_rating='DNF' OR star_rating='W/O' ORDER BY star_rating DESC,title ASC"); ?>
while($movie = $db->get_row($result)): ?>
if(!preg_match('@[0-4]@',$movie['star_rating'])): ?>
if($movie['star_rating']!=$last_star_rating): ?>
= $movie['star_rating'] ?>
endif; $last_star_rating = $movie['star_rating']; ?>
= _e($movie['title']) ?> (= _e($movie['year']) ?>, = _e($movie['directors']) ?>)
endif; endwhile; ?>