Welcome Guest, Not a member yet? Register   Sign In
How can i get the particular Row Id in foreach loop ...?
#1

Problem.:-
  register user can posted post in my site .. and  write the comments about the posts ... but i am display the posts from database useing foreach loop (View like below image posted_posts image ) user can try to write the comment .. in particular post then i insert a particular post id to my comments table the problem is  .. In their grabing post id only first row id is inserted ... when ever i will try to insert a any posted post .. but in comment table post id is insert first row of posted post ..


Question :-
How Can i catch particular row id in foreachloop ...? when i will try to insert id ... that will be insert the fisrt record of the loop ...? how can i slove that ...?  .. when ever i cl;ick the 4 th record of the loop .. return the firstr record id of the loop ... How to get the 4th record id....?
Thank U...  
 See the below image and solve my problem...

Attached Files Thumbnail(s)
               
Manikanta
Reply
#2

Will you please enter your code here..? please
Rolleyes
Reply
#3

It's not really clear what the problem is.
What's the code of your forms (post and comment)?
Maybe you just forgot to add a hidden field with the post_id to your comments form?

Like this (with the form helper):
PHP Code:
echo form_open();
echo 
form_hidden('post_id'$post_id);
//your other fields
echo form_submit('submit','Submit');
echo 
form_close(); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB