Soldato
- Joined
- 12 Feb 2006
- Posts
- 17,627
- Location
- Surrey
having problem getting my database to only update one record based on 2 conditions. i was saying if the user is logged in update table latestThreadView set time = $time where userId = $userId and threadId = $threadId
this works when logged in but when i then say if not logged in everytihng the same but i say where userId = 0 and threadId = $threadId, this ends up updating every record that threadId matches.
is it possible to update based on 2 conditions?
i have tried putting 'and' between the conditions, a comma, '&', and using WHERE before both conditions but none seem to fix the problem, infact sometimes this results in the record being updated that was set by someone who was logged in rather then the record created by the current unlogged in user which is really odd
this works when logged in but when i then say if not logged in everytihng the same but i say where userId = 0 and threadId = $threadId, this ends up updating every record that threadId matches.
is it possible to update based on 2 conditions?
i have tried putting 'and' between the conditions, a comma, '&', and using WHERE before both conditions but none seem to fix the problem, infact sometimes this results in the record being updated that was set by someone who was logged in rather then the record created by the current unlogged in user which is really odd
Last edited: