Hello, All:
I keep having this issue.. I want to make it possible so that a logged member is able to delete ONLY his own records... I have the following related tables:
ACCOUNTS table:
id email pw date
1 user1@site.com 123 10-01-08
2 user2@site.com 456 10-01-08
NOTEPAD table:
noteid custid subject note notedate completed
4 1 Links user-1-note 10-05-08 no
5 2 Contacts user-2-note 10-04-08 no
As you can see the common-relationship in the tables are the id and the custid fields which refer to the username (his email) when logged in. So when I want to echo each user's respective "records" I use the following sql, which seems to work fine, by selecting ONLY a logged-in user's respective "note" records:
SELECT
FROM NOTEPAD, ACCOUNTS
WHERE NOTEPAD.custid = ACCOUNTS.id AND email = colname
ORDER BY NOTEPAD.notedate DESC
*colname refers to logged-in user's "session" username.
But again, I cant figure out how to structure an if/else and sql statement so that a logged user is able to DELETE ONLY his own records. I was able to make it so a logged-in user can delete his own records (by calling his record thru the URL), but then, when I forced a record-id into the url coinciding with another user's record, it DELETED IT!!!
Appreciate any help...