Current Location: United Kingdom
None - I-Pod needs recharging
I am teaching myself PhP and MySQL, and I have a PhP website which calls blog entries from a MySQL database.
I really want to add the ability for people to leave comments to each individual entry on the blog. What I ALSO want to add is the ability for people (Namely me) to then leave replies to those comments, and then maybe for people to leave replies to those replies, similar to the systems available on some forums and Livejournal.
Here is where it gets complicated. The comment system I figured out is a "Select * from comments where blog_id = 1" and a "while mysql_fetch_array" function to display the results. I imagine the comment replies to be a similar "Select * from comments where comment_id = 1".
However, the problem I can't figure out is that I am never going to know from one day to the next how long a reply string is going to be. Short of having an infinite number of "mysql_query" and "while mysql_fetch_array" functions embedded one inside the others coding brackets, I can't think how to make this work so that there will always be enough recalls for the length of the string. If I only have 6 select queries, then the 7th reply will never be displayed.
Does anyone have any suggestions of where I should aim my research ^_^ Is there a way to get PhP or MySQL to predict the length of a reply string and act accordingly?