global $my->username // this is joomla style of doing things
SELECT COUNT(*) as "my messages"
FROM _INBOX
WHERE `towho` = $my->username;
WHERE `towho` = $my->username AND `read_status` = 0; // be careful with intergers 8)
global $my->username // this is joomla style of doing things
global $database;
$query = "SELECT *".
"\n FROM _INBOX".
"\n WHERE `towho` = $my->username ";
$database->setQuery($query);
//normally check to see if your SQL is being worked properly at this point, but ill skip this and Load an array of results
$results = $database->LoadObjectList() ;
//you can then use php to count this results
$total = count($results);
//you then count the number of results in the array for which $results->read_status
$unread = count($results->read_status == '0');
//echo everything your style
echo 'You have '.$total.' messages of which '.$unread.' are unread'; //infact you could do this whatever way you wish!
global $my->username
global $my_username
<?php
global $my->id;
global $database;
$query = "SELECT *".
"\n FROM _UDDEIM".
"\n WHERE `toid` = $my->id ";
$database->setQuery($query);
$results = $database->LoadObjectList() ;
$total = count($results);
$unread = count($results->read_status == '0');
echo 'Messages - Total '.$total.' / New '.$unread.';
?>
<?php
global $database, $my->id ;
$query = "SELECT * ".
"\n FROM `#__uddeim`".
"\n WHERE `toid` = $my->id" ;
$database->setQuery($query) ;
//check for any errors
if ( !($database->loadObjectList()) ) {
echo $database->stderr();
return false;
}
//object lists
$messages = $database->loadObjectList();
//count number of $messages
$total = count($database->loadObjectList()); usint the php count function
//count unread messages i.e number or arrays in object lists for wich $messages->toread is equivalent to zero
$unread = count($messages->toread == '0') ; //not so sure here will check this for you tommorrow if it does not work
//out put the results
echo 'You have'.$total.' messages, of which '.$unread.' are unread' ;
?>
Time to create page: 0.070 seconds