if($next = $DB_site->query_first("SELECT whatever FROM table WHERE articles_articleid > $artid ORDER BY artid ASC")) { $nextarticle = 1; } if($previous = $DB_site->query_first("SELECT whatever FROM table WHERE articles_articleid < $artid ORDER BY artid DESC")) { $prearticle = 1; }