I'm new programmer and learning how to get data from database using Codeigniter and Java. Currently doing a system for user to post comment on different post. Below each post will have "post comment" button. For example, there were several post on a page. When a user click on button "Post a Comment" on A post, it will link to another page posting the comment, but how to make the page know that it post comment on A post. After post the comment, the database will show like user post the comment at A post. Any website for me to refer or study about it? thank you...
Asked
Active
Viewed 50 times
-2
-
1You should add some code, otherwise a lot of user will vote down your question. – Deniz B. Apr 27 '16 at 08:24
-
Agreed with Deniz put some code or else you will have a many down votes, also adding code will help us know how to help you – Rajan Apr 27 '16 at 10:17
1 Answers
0
Let's say you have a post with id (primary key, generated by the database) 37. Then, the button or link just below the post should have a link to something like:
'index.php/comment/newcomment/37'.
Here, comment
is your controller to be used for handling the comments and newcomment
is the function in the comment controller. In newcomment
function, you can take the post id (37 in our example) as the parameter of the function.
You can refer to CodeIgniter: adding parameters to URL for more information.

Community
- 1
- 1

Ahmet Eren Başak
- 493
- 1
- 4
- 14