Skip to content

Commit

Permalink
fixed function
Browse files Browse the repository at this point in the history
  • Loading branch information
shreja19 committed Apr 20, 2022
1 parent 57b413a commit 7de34f6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions classes/class.user.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,20 @@ public static function getFullName()
return $result["fname"].' '.$result["lname"];
}

public static function getAllMessagesByUser($userId) {
public static function getAllMessagesByUser() {

$result = DatabaseConnector::query('SELECT msg_id, user_id, item_id, message_body, approval_timestamp, is_acknowledged FROM message WHERE user_id='.$userId, array());
return $result;
}
$user_id = User::isLoggedIn();
$result = DatabaseConnector::query("SELECT msg_id, uid, item_id, message_body, approval_timestamp, is_acknowledged FROM message WHERE uid='$user_id'", array());
return $result;
}

public static function getAllMessagesCount() {
public static function getAllMessagesCount() {

$userid = User::isLoggedIn();
$result=DatabaseConnector::query('SELECT COUNT(*) FROM message WHERE uid=:userid', array(':userid'=>$userid))[0]['COUNT(*)'];
return $result;
}

}

//use this function in the user class to see if the user is logged in
public static function isLoggedInWithRedirect()
Expand Down

0 comments on commit 7de34f6

Please sign in to comment.