Help with database query. |
Hey guys,
For some reason today I just can't seem to think. I am currently working on part of my Forums solution, and I am working on the 'delete comment' function. Now where my problem lies is in the 'discussions' table I store the 'last_comment_id'. When you bring up the front page of the forums ( with all the discussions listed ) it says 'Last comment by {username}'. Now on to my question. Lets say I have 10 comments for that discussion, and just for example sake the ID's of them comments are 1 through to 10. I want to delete 10, what i need to do is grab the comment ID before 10 ( so 9 ) for this discussion. How would I go about doing this? As I said I know its a really daft question but my brain has turned into mush and I just can't seem to think straight. Any help would be appreciated guys. Chris
You can do something like that (with mysql).
PHP Code: delete from comments where id = 10
(04-23-2015, 05:03 AM)Rufnex Wrote: You can do something like that (with mysql). Haha i knew I was over thinking this! It was the query that I could not think of. Thats great mate thank you very much for the swift reply =) |
Welcome Guest, Not a member yet? Register Sign In |