Quote:
Originally Posted by cinq
Problem 2 solved ! ( thanks Rake ! )
Code used :
PHP Code:
# previous and next article links
if($nextone = $DB_site->query_first("SELECT articles_articleid FROM " . TABLE_PREFIX . "articles_article WHERE articles_articleid > $artid AND categoryid = $categoryid ORDER BY articles_articleid ASC LIMIT 1"))
{
$nextone = $nextone['articles_articleid'];
$nextarticle = 1;
}
if($previousone = $DB_site->query_first("SELECT articles_articleid FROM " . TABLE_PREFIX . "articles_article WHERE articles_articleid < $artid AND categoryid = $categoryid ORDER BY articles_articleid DESC LIMIT 1"))
{
$previousone = $previousone['articles_articleid'];
$prearticle = 1;
}
Decided to put in
PHP Code:
AND categoryid = $categoryid
to limit to previous or next articles in the same category.
|
you can do that in one query.