3

I have spent the last 3.5 hours working on some (PHP) code that did not do as was expected/desired due to finding that all the multiple purpored internet answers, including some referenced on SO itself, was seriously deficient in various respects.

I have now found my own (general) solutions but feel that the wider internet doesn't have the correct information on this issue. The issue being how to store PHP session data in a database. There are answers all over the place (several of them with their own incorrect syntax / issues ) and generally all following the same pathline, but the current solutions I have found are suffering for at least 2 fundamental issues that are not addressed anywhere I can find and so my query on the meta is this:

Is it a suitable action to post a question solely so that I can then post my own answer?

Something like question being "how do I use a database to store my sessions" and the answer being all the useful nuggets I've found on this issue while it's relatively fresh in my mind.

Qualifier: Other questions (the few there are) on SO on the same subject are quite old and I don't think I should be digging them up as they're significantly more specific to the situation(s) of the Question Poster.

(Yeah, I would put this on a blog if I had a blog but I don't and StackOverflow is the right crowd to learn from these issues)

6
  • So this is an answer to a question that already exists on SO?
    – Jongware
    Apr 20, 2016 at 17:40
  • There are a half dozen or so related Qs and As on SO but they're not focused mainly on this topic, except one poster whose trying to do this himself rather than letting PHP session handler work for them.
    – Martin
    Apr 20, 2016 at 17:45
  • 3
    Possible duplicate of Is it OK to promote my own code by self-answering my own questions?
    – gnat
    Apr 20, 2016 at 22:42
  • "I would put this on a blog" is hinting on answer being too broad. Make sure to read question linked by @gnat which I agree is at least very close if not duplicate to your case. Apr 20, 2016 at 22:56
  • I strongly disagree with the suggested duplicate target. That question deals with an entirely different issue (self promotion), and suggests the opposite conclusion of the (correct) answer provided by Shog9 below. It is misleading to point to it as a duplicate.
    – skrrgwasme
    Apr 21, 2016 at 7:05
  • @skrrgwasme you'll see that it's a dupe if you look beyond top voted answer. Second top an especially third top answers cover what is asked about here. "- Is it OK to post a question on Stack Overflow and answer it myself? - Yes, definitely. However, you need to care about asking the correct type of question for it..."
    – gnat
    Apr 21, 2016 at 8:01

1 Answer 1

7

Well, yes, you can post a question purely for the purpose of answering it yourself - there's even a handy little tool built in for that:

That said... You don't want to do this if your question will be a duplicate or too broad. In particular, if there are already rather a lot of questions similar to this on the site you might be better off just picking one of them and writing a good comprehensive answer to it; nevermind if you end up going a bit beyond what the asker originally requested, your answer is for the benefit of future readers and the question can always be edited anyway.

2
  • I will try and limit my question to not be broad but relevant, cheers for the confirmation.
    – Martin
    Apr 20, 2016 at 17:46
  • 1
    @Martin, note that asking good self-answered question is harder than one may think... Especially for questions that have existing similar posts on SO/everywhere else. Apr 20, 2016 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .