I'm building a site that allows all visitors to view property listings made by multiple users (anyone who registers and is approved basically). It's been easy so far setting up the registration area, the listings viewing area, and the area for adding new listings. The question is, how can I best construct an admin area where, once logged in, each user is greeted with a "dashboard" of sorts which displays property listings created by said user ONLY (which they can then edit)?
I should mention (though you've probably already assumed) that each property listing has a unique id and a created_by_user_id, and I'm using MySQL.
Any ideas would be greatly appreciated. Thanks!
Allowing users to edit ONLY their own data
Moderator: General Moderators
Re: Allowing users to edit ONLY their own data
Should be pretty straightforward. If every property listing record includes a created_by_user_id field, and your user is logged in, you are probably storing the login as a session variable, so just use that in the WHERE clause of your SQL query to limit the results to those with that user's id. Am I missing something?imderek wrote:I'm building a site that allows all visitors to view property listings made by multiple users (anyone who registers and is approved basically). It's been easy so far setting up the registration area, the listings viewing area, and the area for adding new listings. The question is, how can I best construct an admin area where, once logged in, each user is greeted with a "dashboard" of sorts which displays property listings created by said user ONLY (which they can then edit)?
I should mention (though you've probably already assumed) that each property listing has a unique id and a created_by_user_id, and I'm using MySQL.
Any ideas would be greatly appreciated. Thanks!
Why don't you show us the SQL statement you are using now.