Well, it would depend on the structure of your database and how you're getting the member's id and/or username (however you check if they're logged in).
This is exaaclty right. However, you will need to know what user is logged in in the first place and there are several ways to do that. id will = the user id assigned in you web page to the currently loged on user.