Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by

How would I go about structuring a SQL INSERT to create a comment in the Q2A database?

From my research so far, I'm working out that comments in the SQL are stored in qa_posts, e.g

INSERT INTO qa_posts VALUES ('$postId', 'C', (lots of other data), 'Comment message.', NULL, NULL);

1 Answer

+2 votes
selected by
Best answer
Hmm... why would you want to do that this way ?

I think you are making things harder than they should.

Why not using a ready made function for this instead?

Have a look at the example there, at the botom of the page (this example is for a question, but for a comment that would work as well using C as a type). BTW, compared to raw insert in the DB, it takes care of other things like the user id it relates, sending out an email notice...


More ready made functions there:

Good idea. Thanks for the pointer.