Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
974 views
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
by
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...

http://www.question2answer.org/external.php

More ready made functions there:

http://www.question2answer.org/functions.php
by
Good idea. Thanks for the pointer.
...