January photo competition winner
$my_category = $node->field_photo_category['0']['value'];
$result = db_query("SELECT * FROM content_type_photo_upload WHERE field_photo_category_value = '$my_category' order by update_time DESC");
$found_self = false;
$last_object;
$prev_object;
$next_object;
while($object = db_fetch_object($result)) {
if ($object->nid == $node->nid) {
$found_self = true;
$prev_object = $last_object;
} else if ($found_self) {
$next_object = $object->nid;
break;
}
$last_object = $object->nid;
}
if ($prev_object)
echo 'Previous ';
if ($next_object)
echo ' Next';
?>
echo $node->body; ?>
