Seeing other peoples posts
I'm currently making a note web app that going pretty well. I have the CRD part of CRUD finished. But besides that, I'm having a bit of a开发者_如何学Pythonn issue with privacy.
If I make a new note, Other people can see it. This is a bit scary. I think it's a problem with the WHERE statement at the end, because I'm assigning one item to the next. How can i fix this?
$usersname = "users";
$notename = "note";
$query = "SELECT $usersname.name, $notename.title, $notename.note, $notename.date FROM $usersname, $notename WHERE $usersname.name = $notename.name";
SELECT $notename.title, $notename.note, $notename.date
FROM $notename
WHERE $notename.name = $userAllowedToSee
OR
SELECT $notename.title, $notename.note, $notename.date
FROM $notename
JOIN $usersname ON $usersname.name = $notename.name
WHERE $usersname.name = $sessionUserName
精彩评论