Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • How do you have this setup? Each comment should be it's own row in the database. Therefore no need to update but to insert. Unless your "comments" column should actually be singular. Commented Feb 12, 2018 at 4:29
  • what is your DB driver ? what is the meaning of "The comment table simply fills the empty columns with NULL." Commented Feb 12, 2018 at 4:29
  • I am using PHPmyadmin as a local server. Commented Feb 12, 2018 at 6:06
  • I mean this, when I insert a post into the posts table as an admin, I have a separate query that inserts that id in the post_id column in the comments table. The post_id column is the foreign key. I then have a separate query that is to update the comments table when someone comments. When I run this query, it does not fill the other fields in the comment table.they are instead written as NULL Commented Feb 12, 2018 at 6:09
  • So Nick you mean that instead of updating I should simply insert using, "..WHERE post_id = sth.."? How will the comment be related to the post? Commented Feb 12, 2018 at 6:12