loop thru MySQL recordset to get unread count
So, just trying to get a simple function running. I have 2 tables in my mariaDB, 1 for journal entries, and 1 for journal entry has been read entry. Just trying to loop thru all the records in my journal entries, and if there is an entry in the read section for it, it adds 1 to the variable and loops thru to get the total amount of Unread notifications ( meaning there's not any entry for that user in the journal_read table that shows the read the entry ) and then return the number so I can echo it on my top bar where I want it.
$jid = journal entry ID
$pid = user ID grabbed from the session
link.php is my maria credentials
I'm using the Webassist MySQLi deal for my dreamweaver, and of course, it does not have this option built in.
function UnreadJournalCount() {
require($_SERVER['DOCUMENT_ROOT'] . 'link.php');
$NotificationsListTotalNew = new WA_MySQLi_RS("NotificationsListTotalNew",$link,0);
$NotificationsListTotalNew->setQuery("SELECT * FROM journal");
$NotificationsListTotalNew->execute();
foreach ($NotificationsListTotalNew as $row):
if(CheckJournalRead($row["jid"],$_SESSION['pid']) == "true"){ $UnreadCount = $UnreadCount + 1; }
endforeach;
return $UnreadCount;
}
However, when I change $row["jid"] to $NotificationsListTotalNew->getColumnVal("jid") to more error, but it skips the first row, and I only get 16 rows. Any help would be lovely.