PDA

View Full Version : counting entries


AN-net
08-12-2005, 06:10 PM
ok ive got myself in a small bind... how would i assign a number for each entry returned(example: #1, #2 #3, #4) without a page number withonly the perpage and which entry to start at:
here is where i am at:

function grabentries($cache, $sort = 'ASC', $order = 'entrydate', $startat = 0, $perpage = 15)
{
global $DB_site, $vboptions;

$grabentries= $DB_site->query("SELECT journal_entries.entry_id, journal_entries.entrytitle,
journal_entries.entrytext, journal_entries.mood, journal_entries.entrydate,
journal_entries.entry_totalvotes, journal_moods.mood_name, journal_entries.ipaddress,journal_moods.mood_image , journal_entries.entry_totalrating,
COUNT(journal_comments.comment_text) AS comments
FROM ".TABLE_PREFIX."journal_entries AS journal_entries
LEFT JOIN ".TABLE_PREFIX."journal_comments AS journal_comments ON (journal_entries.entry_id=journal_comments.entry_i d)
LEFT JOIN ".TABLE_PREFIX."journal_moods AS journal_moods ON (journal_moods.mood_id=journal_entries.mood)
WHERE journal_entries.entry_id IN (".implode(',', $cache).")
AND entry_active='1'
GROUP BY journal_entries.entry_id
ORDER BY ".$order." ".$sort."
LIMIT ".$startat.", ".$perpage."
");
while($entry= $DB_site->fetch_array($getentries))
{
}
}

Marco van Herwaarden
08-12-2005, 07:48 PM
$startat is your starting number, so just increase that for each entry

AN-net
08-12-2005, 09:10 PM
oh that makes sense LOL