Permabanned
- Joined
- 25 Oct 2004
- Posts
- 9,078
Hiya all, been pulling my hair over this as I just cant seem to figure it out, basically what I have an internal message system on an auction site ive helped create for a charity and I've added some additional functionality to it like if a message is read or not, when you replied to it etc
What im attempting to add now is a notification system if you have new messages ie a (3 Unread Messages) i've got the sql code working with phpmyadmin, it returns the correct value np but I just cant seem to get it working within the site.
This is the code i have, the sql_query is echo'd out to verify its ok and its fine, but no result is shown, if i print_r the $count data i get an array but no idea how to display the result.
the two echo's are just for debugging. Any idea why it wont display the count value, in the above case when logged in as site admin it should return 1, and it does if i put the above sql query into phpmyadmin (minus the site specific code that is).
What im attempting to add now is a notification system if you have new messages ie a (3 Unread Messages) i've got the sql code working with phpmyadmin, it returns the correct value np but I just cant seem to get it working within the site.
This is the code i have, the sql_query is echo'd out to verify its ok and its fine, but no result is shown, if i print_r the $count data i get an array but no idea how to display the result.
PHP:
$this->sql_query = "SELECT COUNT(*) FROM ".$this->user_communications_table." WHERE message_to=".$this->classified_user_id." AND message_read!=1";
$count = $db->Execute($this->sql_query);
echo $this->sql_query."<br />";
echo "\"".$count."\"";
if ($count == 0) {
$comm = urldecode($this->messages[425])."</span></a></div>";
} else {
$comm = urldecode($this->messages[425])." (".$show->$count." Unread)</span></a></div>";
}
the two echo's are just for debugging. Any idea why it wont display the count value, in the above case when logged in as site admin it should return 1, and it does if i put the above sql query into phpmyadmin (minus the site specific code that is).