Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Sep 23, 2007 9:29 pm Reply with quote

This displays all comments or questions from a student population.

The reply from a course director ($rid) need to be displayed just underneath its corrosponding question ($cid).

Comment table
$cid

Reply table
$rid
$cid

Each record in the reply table will have a matching cid from the comment table.

I have to figure out the proper loop and why I was getting all 4 replies for a single comment.

http://www.donovanfamily.us/index_funtion.txt


I also have another way of doing this by using another function and passing the $cid.


http://www.donovanfamily.us/displayReply_function.txt

Not quite working as planned but I'm almost ready to demo this.

Just need to figure out why I was getting all my replies displaying under one comment.
 
View user's profile Send private message Visit poster's website ICQ Number
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Sep 24, 2007 6:06 am Reply with quote

Donovan, it appears that you have a one-to-many relationship between these two tables, so, how were you wanting to restrict the comments to just one? What would be your functional requirement for this restriction (i.e., in words)?

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Donovan







PostPosted: Mon Sep 24, 2007 6:26 am Reply with quote

Well every rid has a corrosponding cid taken when the reply is sent. The cid is inserted into the reply table to link the two.

I thought a simple

Code:
SELECT * FROM reply r JOIN comments c WHERE c.cid= r.cid
would do the trick.
 
Donovan







PostPosted: Mon Sep 24, 2007 8:52 am Reply with quote

I just made this all one query and it seems to work.
 
montego







PostPosted: Tue Sep 25, 2007 6:10 am Reply with quote

Cool...
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©